You are here: irt.org | FAQ | CGI | Q1505 [ previous next ]
Try:
require CGI;
$escaped = CGI::escape( $normal );
# ...or...
sub escape {
my $str = shift || '';
$str =~ s/([^\w.-])/sprintf("%%%02X",ord($1))/eg;
$str;
}
$escaped = escape( $normal );