X-Git-Url: http://git.shiar.net/perl/plp/.git/blobdiff_plain/60df7c89bf8eb6f20a41600a6186a990561eb77a..5d65ad9b409494bb4e7c98a27d29079e09b111f5:/PLP/Functions.pm diff --git a/PLP/Functions.pm b/PLP/Functions.pm index fe1f39c..28815cd 100644 --- a/PLP/Functions.pm +++ b/PLP/Functions.pm @@ -52,8 +52,8 @@ sub DecodeURI (@) { my $ref = defined wantarray ? [@_] : \@_; for (@$ref) { eval { - s/\+/%20/g; # Browsers do y/ /+/ - I don't care about RFC's, but - # I do care about real-life situations. + tr/+/ /; # Browsers do tr/ /+/ - I don't care about RFCs, but + # I do care about real-life situations. s/%([0-9A-Fa-f][0-9A-Fa-f])/chr hex $1/ge; }; } @@ -213,7 +213,8 @@ In void context, B the values of the given variables. In other contexts <: print Entity($user_input); :> Be warned that this function also HTMLizes consecutive whitespace and newlines (using   and
respectively). -For simple escaping, use L. To escape high-bit characters as well, use L. +For simple escaping, use L. +To escape high-bit characters as well, use L. =item EncodeURI LIST @@ -227,11 +228,13 @@ Note that the following reserved characters are I percent-encoded, even tho / ? : @ $ -This should be safe for escaping query values (as in the example above), but it may be a better idea to use L instead. +This should be safe for escaping query values (as in the example above), +but it may be a better idea to use L instead. =item DecodeURI LIST -Decodes %-encoded strings. Unlike L, it also translates + characters to spaces (as browsers use those). +Decodes %-encoded strings. Unlike L, +it also translates + characters to spaces (as browsers use those). In void context, B the values of the given variables. In other contexts, returns the changed versions.