sub unuriescape { # Note from RFC1630: "Sequences which start with a percent sign # but are not followed by two hexadecimal characters are reserved # for future extension" my $str = shift; if (@_ && wantarray) { # not executed for the common case of a single argument my @str = @_; # need to copy return map { s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg } $str, @str; } $str =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg; $str; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Decode a string from a URL
by Anonymous Monk on Mar 04, 2002 at 16:25 UTC |