Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 75120
Status: resolved
Priority: 0/
Queue: CGI

People
Owner: Nobody in particular
Requestors: dynot [...] JUNKMAIL.ATH.CX
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: '+' converted to space in POST/GET
For a simple program like this (named cgi.pl): #!/usr/bin/perl -w use strict; use CGI; my $cgi = new CGI; print $cgi->param('a'); All plus characters are converted to spaces: ./cgi.pl 'a=1+2' 1 2 Same happens if I try it with a POST or GET request. The 9 year old bug returned: https://rt.cpan.org/Public/Bug/Display.html?id=1933 (perl v5.12.4 built for i486-linux-gnu-thread-multi-64int) Tried in CGI v3.43 and v3.49
Subject: Re: [rt.cpan.org #75120] '+' converted to space in POST/GET
Date: Mon, 20 Feb 2012 10:25:32 -0500
To: bug-CGI.pm [...] rt.cpan.org
From: Mark Stosberg <mark [...] summersault.com>
Show quoted text
> Same happens if I try it with a POST or GET request. The 9 year old bug > returned: > > https://rt.cpan.org/Public/Bug/Display.html?id=1933
This is spec-compliant. You'll find that even more modern tools do this: # Also translates plus to space use Plack::Request; my $r = Plack::Request->new({ QUERY_STRING => 'a=1+2' }); print $r->param('a'); There was a discussion about this in the PHP bug tracker: https://bugs.php.net/bug.php?id=39078&edit=1 You'll see that ultimately points back to a spec: http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1 On these docs on About.com, you'll also laid out in a table that "Plus indicates a space": http://webdesign.about.com/od/forms/a/url_encoding.htm You used a reserved character improperly and should encode it to achieve your expected result. Mark