Pathologically Eclectic Rubbish Lister | |
PerlMonks |
CGI fails to urlencode & chars in outbound url'sby BrowserUk (Patriarch) |
on Jun 12, 2002 at 10:36 UTC ( [id://173755]=perlquestion: print w/replies, xml ) | Need Help?? |
BrowserUk has asked for the wisdom of the Perl Monks concerning the following question: In the following line, @list contains relative paths read from the underlying filesystem using readdir
The problem is that some of these directories can contain spaces and or & characters (and others no doubt but I haven't fallen foul of these yet!). CGI correctly urlencodes (on output) the spaces as %20 but doesn't encode the & as %26 which means that when the url is parsed on input, the & is being treated as a search parameter seperator. Meaning that in the URL:
param() returns 'Chalk ' instead of 'Chalk & Cheese' Is there some way of forcing CGI to encode the & as %26? Is there a urlencode() function I could use? Assuming there is a urlencode(), how would I incorporate this with the line above so as to have the map operate it upon each of the parameters? My attempts at searches of local and online docs have so far not turned up a solution to this. Thanks.
Back to
Seekers of Perl Wisdom
|
|