in reply to Re: Re: CGI fails to urlencode & chars in outbound url's
in thread CGI fails to urlencode & chars in outbound url's
CGI::escape comes from CGI::Util and is not documented (the code is the documentation :-). It is used within CGI.pm and is usable outside, too.
#### from CGI/Util.pm sub escape { shift() if ref($_[0]) || (defined $_[1] && $_[0] eq $CGI::DefaultCla +ss); my $toencode = shift; return undef unless defined($toencode); $EBCDIC = "\t" ne "\011"; if ($EBCDIC) { $toencode=~s/([^a-zA-Z0-9_.-])/uc sprintf("%%%02x",$E2A[ord($1)] +)/eg; } else { $toencode=~s/([^a-zA-Z0-9_.-])/uc sprintf("%%%02x",ord($1))/eg; } return $toencode; }
For more info see Dump a directory as links from CGI.
escapeHTML is fine to produce HTML, but not useful for URIs (your "&" is the best example). If we have an unescaped "&" then this is a parameter delimiter.
alex pleiner <alex@zeitform.de>
zeitform Internet Dienste
In Section
Seekers of Perl Wisdom