Hi there,
I made a function in Perl to unescape escaped characters (like in JavaScript). BUT, the strings are imported from a input txt file.
Example: escape this
Code:
%2Ebu%74to%6E%3D%3D%32%29|%7C%28e%76en%74%2Eb%75tt%6Fn%3D%3D3%29%29%7Br%65tu%72n
gives
.button==2)
and it should have given
.button==2)||(event.button==3)){return
I use my routine:
Code:
sub UNESCAPE {
my($todecode) = @_;
$todecode =~ tr/+/ /;
$todecode =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
return $todecode;
}
Everything was well until the "|" show up. The function only unescapes until the "|" (and probably until special characters). If we put the sequence between "" it works. But if we fetch it by input, everything goes wrong...
How can I solve this?
Rigel_Kent