jason at jorendorff.com
Thu Jan 24 03:14:07 EST 2002
olav viken wrote:
> I'm having a problem passing the '#-character' to a cgi-script.
> The cgi script is invoked with a url as this:
The CGI script is behaving correctly; it's the URL that's incorrect.
Your browser is behaving correctly by *not* sending the # sign
(or anything after it) to the server.
Special characters like quotes, colons, and the # symbol must
be encoded if you want to include them in a URL. You can encode
them with the urllib.quote() function.
>>> import urllib
>>> print urllib.quote('"T:/test.htm#Mark"')
So this is the correct URL:
It looks strange, but the CGI module understands it and will
automatically convert the encoded characters back to normal
characters for you. Try it.
## Jason Orendorff http://www.jorendorff.com/
More information about the Python-list