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

Taavi Burns taavi-LbuTpDkqzNzXI80/IeQp7B2eb7JE58TQ at public.gmane.org
Thu Aug 5 20:08:38 UTC 2004


On Thu, Aug 05, 2004 at 03:53:51PM -0400, Madison Kelly wrote:
> 
> 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]
> 
> 
> 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.
> 
> 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!

The % notation in the URL is a way of escaping arbitrary ASCII characters.
ASCII 0x20 is the space character.  I imagine that the "correct" way to
embed % into a URL is to use %25 (because % is 0x25).

So, you'd get:
http://192.168.1.99/cgi-bin/show-dirs.cgi?file_name=on-screen%2520ping%2520pong[1]

See section 2.4.1 of RFC2396: Uniform Resource Identifiers (URI): Generic Syntax
http://www.ietf.org/rfc/rfc2396.txt

-- 
taa
/*eof*/
--
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