Subject: | '+' converted to space in POST/GET |
In CGI.pm - a + character passed in a form textfield is converted to a space when you do something like
print $queryin->param('crusty');
I suggest that there is at least 1 spurious $foo=~tr/+/ /; or similar statement in CGI.pm - or that the unescape sub is called more than once (which contains that statement). The value of the crusty variable is correctly urlencoded when it gets to the server (tested with
Example 19.6: dummyhttpd from the Perl cookbook)
I don't think that OS or perl ver are relevant, but it's solaris 8 (discovered on machine running solaris 7) and perl v5.6.0 built for sun4-solaris. Apache 1.3.27, mod_perl 1.27. CGI.pm is ver 2.89 and CGI.pm,v 1.75 2002/10/16 17:48:37 lstein
The problem is reproducible with the following form and cgi script - enter a string containing '+' character into the form and watch it disappear!
Testform:
<HTML>
<BODY>
<FORM method=post action=cgi-bin/webchange.cgi>
<INPUT NAME=crusty type=text>
<!-- <INPUT NAME=crusty type=password> -->
<INPUT type=submit>
</FORM>
</BODY>
</HTML>
CGI script (webchange.cgi):
#!/opt/perl/bin/perl
# use strict;
# use IO::Socket;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
my $queryin = new CGI();
print CGI->header();
print $queryin->param('crusty');
Any questions - feel free to contact me - nic@coombs.anu.edu.au
Cheers,
nic.