|
|
||||

Here's an excellent way to encode strings that are going to be placed in a URL:
$str =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
$str can now be passed in the query string safely, for example:
<a ref="page_given_string.php?str=$str">LINK</a>Likely, "page_given_string.php" will want to decode $str back into something useful:
$str =~ s/\%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg;