in reply to To decode URL-decoded UTF-8 string.
Produces from your input: об/стенwhile(<>) { print &urldecode($_); } sub urlencode { my $s = shift; $s =~ s/ /+/g; $s =~ s/([^A-Za-z0-9\+-])/sprintf("%%%02X", ord($1))/seg; return $s; } sub urldecode { my $s = shift; $s =~ s/\%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg; $s =~ s/\+/ /g; return $s; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: To decode URL-decoded UTF-8 string.
by Your Mother (Archbishop) on Sep 03, 2018 at 20:34 UTC | |
Re^2: To decode URL-decoded UTF-8 string.
by nikolay (Beadle) on Aug 28, 2018 at 10:02 UTC |