Answer the question
In order to leave comments, you need to log in
Proper handling of "+" in a GET request?
The project is made in PHP.
There is a link like server.com/index.php?email=name%[email protected] Following
such a link causes the browser (Firefox) to convert %2B to "+".
Next, the server receives a GET request in PHP as "name [email protected]".
That is, the browser, server, or PHP treats the "+" character as a space.
I need to have "[email protected]" in the GET variable, not "name [email protected]".
You can, of course, replace the space with "+" already in the code, but maybe there is a more correct solution to this problem?
Answer the question
In order to leave comments, you need to log in
Are you sure it's the browser that converts? In theory, if there really is such a link, then [email protected] should just come to the script. It is possible that somewhere at the stage of link formation, an incorrect operation occurs.
I had this problem with mod_rewrite in apache. Solved by double escaping url_encode() (and double decoding, respectively)
$_SERVER['REQUEST_URI'] what's in there? maybe you have a tricky filter there
Here are suggested solutions for this: www.dracos.co.uk/code/apache-rewrite-problem/
You can also try flag b , but as far as I understand, there will be a reverse situation - the space will turn into '+'.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question