Re: Plus sign changing to space in html form
| From: | Stan | Date: | Tue, 29 Oct 2002 13:14:56 +0000 |
| Subject: | Re: Plus sign changing to space in html form | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-121846@lists.php.net to get a copy of this message | ||
When i enter
1%2B1%3D2
to the input form and submit, the result is
1+1=2
It looks like the http request received by php is not
"application/x-www-form-urlencoded" but php thinks that it is.
I dont know what to think about that.
"Chris Shiflett" <chris@shiflett.org> wrote in message
news:3DBDE88B.7010009@shiflett.org...
> This is true, but the + itself should also be encoded.
>
> I did a quick test, and when I post a form variable called test with a
> value of 1+1=2, the HTTP request looks like this:
>
> POST /test.php HTTP/1.1
> Host: 127.0.0.1
> User-Agent: Mozilla/5.0 Galeon/1.2.6 (X11; Linux i686; U;) Gecko/20020916
> Accept:
>
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=
0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1
> Accept-Language: en
> Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
> Keep-Alive: 300
> Connection: keep-alive
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 14
>
> test=1%2B1%3D2
>
> So, that %2B would have to get decoded twice to result in a space.
>
> Stan, do you have a way to see what the HTTP request is? You mention
> being on a BSD box, so I assume you have tcpdump? Also, is this behavior
> consistent with different browsers?
>
> Chris
>
> John W. Holmes wrote:
>
> >The plus sign is used to signify a space in some URL encoding. PHP is
> >probably thinking the text is encoded and it's removing the plus sign.
> >Not sure on a solution.
> >
> >---John Holmes...
> >
> >>-----Original Message-----
> >>From: Stan [mailto:stann@pobox.sk]
> >>Sent: Monday, October 28, 2002 6:27 PM
> >>To: php-general@lists.php.net
> >>Subject: [PHP] Plus sign changing to space in html form
> >>
> >>When i post a string containing plus sign with htmp form to a php
scritp,
> >>
> >>
> >>the '+' is changed to space. e.g: i enter 'as+df' to a text input
> >>but
$_POST[] returns 'as df' instead.
> >>
> >>
> >>It must be in php or apache configuration bcause i have this problem
only
> >>
> >>
> >>on sytem with FreeBSD. On windows it works as expected.
> >>
> >>Know someone how could i make the '+' left intact? Please help.
> >>
> >>
> >><?
> >>echo $_POST['test'];
> >>?>
> >><form actiom='test.php' method=POST>
> >><input type=text value='' name=test>
> >><input type=submit value='submit'>
> >></form>
> >>
>