in reply to "+" stripped from CGI params

I think, traditionally, the '+' represents a space. I'm not sure what standard dictates this, but it seems to be the case.

You can replace the '+' with a '%2b' to avoid it. Happily, CGI can do this for you if necessary:

my $encoded = $cgi_obj->escape("kk_+kk_");
.

-Paul

Replies are listed 'Best First'.
Re^2: "+" stripped from CGI params
by ikegami (Patriarch) on Dec 21, 2007 at 13:55 UTC

    I think, traditionally, the '+' represents a space. I'm not sure what standard dictates this, but it seems to be th

    I bet you'll find that the URI spec dictates that it must be escaped when it doesn't have a special meaning to the URI, as is the case here.

    One such special meaning was the seperation of keywords in a ISINDEX query (script.cgi?these+are+keyworkds). The query would have had whitespace at those spots, so it was common to replace +s with spaces.

      Yep :) "Within the query string, the plus sign is reserved as shorthand notation for a space. Therefore, real plus signs must be encoded. This method was used to make query URIs easier to pass in systems which did not allow spaces."