passing "%20" in a url to Perl via CGI

Madison Kelly linux-5ZoueyuiTZhBDgjK7y7TUQ at public.gmane.org
Thu Aug 5 19:53:51 UTC 2004


Hi all,

   I've got an odd problem... I am trying to pass file and directory 
names over a link by using (as an example):

http://192.168.1.99/cgi-bin/show-dirs.cgi?file_name=on-screen%20ping%20pong[1]

Where the file name is in fact:

on-screen%20ping%20pong[1]

The problem is that it seems when I pick the variable back up in the 
'show-dirs.cgi' script the '%20' has been converted to a whitespace so 
the file becomes:

on-screen ping pong[1]

I understand that '%20' means in a URL 'whitespace' so I am not too 
surprised but I am a little bit lost as to how to get around this.

I suppose if worse came to worse I could substite '%20' for something of 
my own making before creating the link and then convert it back after I 
pick the variable up from CGI. I worry though that whatever I come up 
with might be in another file name (I have no control over file names) 
and i would simply replace one problem with another. This is double 
confused by the fact that actual white-spaces in a name are themselves 
converted to '%20', too.

Is there a way to preserve the '%20' in a url? Would it fix my problem 
to use a form instead? Thanks for any advice!

Madison
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list