RFC 3986 (generic URI syntax) explicitly says this must be done
and some URI parsers choke on them.
Anyway, I am keeping bare url_escape() as is for the time being,
because it's used for production of user-friendly URLs, too. Needs
cleanup later.
sub url_param_escape($) {
my $x = shift @_;
defined $x or return;
- $x = url_escape($x);
+ utf8::encode($x) if $utf8_mode;
+ $x =~ s/([^-\$_.!*'(),0-9A-Za-z])/"%".unpack('H2',$1)/ge;
$x =~ s/%20/+/g;
+ utf8::decode($x) if $utf8_mode;
return $x;
}