php - Plus sign decoded into space

I send requests from ios and android to some PHP server and some params in GET request are wrongly decoded.

request: http://myserver.com/path?email=john+doe

$_GET['email'] == 'john doe' instead of 'john+doe'
$this->request->get('email') == 'john doe' instead of 'john+doe'

Obviously php (I'm using phalcon) is using urldecode and replace + with 1 space.

How can avoid this? Can I change the type of enconding and "Content-Type" header accordingly?

Answer

Solution:

If you really needed the '+' sign in the PHP file, you may need to have the '+' as '%2B'.

There is nothing wrong in reading the values which you mentioned.

Answer

Solution:

are wrongly decoded

They are correctly decoded.

Can I change the type of enconding and "Content-Type" header accordingly?

No. The Content-Type header describes the format of the request body, not the query string.

You should encode the data in the query string correctly in the first place.

A + sign should be represented as %2B.

Source