Reiner: %C3%B6sterreich -> Österreich umwandeln

Beitrag lesen

Hi,

Alternative:
use URI::Escape;

gibt Dir die Funktionen
uri_escape();
uri_unescape();

z.B:
'gr%FCner%20B%E4r' <-- uri_escape('grüner Bär');

--roro

oder ohne Module:

sub escape
        {
                shift() if ref($_[0]);
                my $toencode = shift;
                return undef unless defined($toencode);
                $toencode=~s/([^a-zA-Z0-9_.-])/uc sprintf("%%%02x",ord($1))/eg;
                return $toencode;
        }

sub unescape
        {
                shift() if ref($_[0]);
                my $todecode = shift;
                return undef unless defined($todecode);
                $todecode =~ tr/+/ /;       # pluses become spaces
                $todecode =~ s/%([0-9a-fA-F]{2})/pack("c",hex($1))/ge;
                return $todecode;
        }

Reiner