in reply to To decode URL-decoded UTF-8 string.

You mean you want to decode url-encoded and the result happens to be in UTF-8
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; }
Produces from your input: об/стен

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

    There are reasons we recommend modules instead of cargo-culting–

    print urlencode("41 + 1 = 42"); # 41 1 = 42 use URI::Escape; print uri_escape("41 + 1 = 42"); # 41%20%2B%201%20%3D%2042
Re^2: To decode URL-decoded UTF-8 string.
by nikolay (Beadle) on Aug 28, 2018 at 10:02 UTC
    Wow! Awesome! That's exactly what i looked for! I read perlfunc man for the pack function, but thought that i need to use h template, and not c . So, my approach failed. Thank you veru much, TheloniusMonk!