develooper Front page | perl.libwww | Postings from June 2003

Escaping the '!' character

Thread Next
Jim Vaught
June 5, 2003 02:30
Escaping the '!' character
Message ID:


I ran into a problem this week with the '!' character not being
escaped (the same problem mentioned in the old "Not escaping all
characters" thread).  I was trying to post form data to a cgi script.
One of the values to be sent ended with an exclamation point.  The
cgi script wasn't working for me.  I made a local copy of the form
page changing the action to a server I wrote which does nothing but log
all data sent to it.  I filled in this form in Netscape 7.0.2 and
submitted it (to the dummy server).  I then pointed my LWP script to the
dummy server instead of the real cgi script.  I noticed Netscape was
sending the '!' as '%21' whereas LWP was sending it as '!'.  I tried IE
6.0 as well, and (not surprisingly... Netscape is probably violating
the RFC in an effort to maintain compatibility with ie) it also sends
'%21' (I'll resist the urge to get on my 'calculated subversion
of industry standards' soapbox).  Just for kicks I tried Lynx
2.8.4rel.1 and it also sends '%21'.  I'm as much of a purist as
anyone, and I realize from the reference to the RFC in the previous
thread on this matter that LWP is doing the officially right thing
here and Netscape, internet explorer, and Lynx are doing the wrong
thing, but when I hacked query_form() in URI/ adding an
exclamation point to the reg-exp's which determine which chars to
escape in the key and value the cgi script I was posting to started
working.  So even though escaping '!' is not what the spec says to
do, it is what Netscape, Lynx, and ie do and it appears that there
are cases where it now needs to be done.


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About