Say I request this URL:
http://mydomain.com/script.php?var=2+2
$_GET['var'] will now be: "2 2" where it should be "2+2"
Obviously I could encode the data before sending and then decode it, but I'm wondering if this is the only solution. I could also replace spaces with plus symbols, but I want to allow spaces as well. I simply want whatever characters were passed, without any url decoding or encoding going on. Thank you!
Whomever is generating the URL containing a
+
in the query segment is wrong unless they intend it to represent a space character. A+
in the query is a reserved character (re: RFC2396 §3.4). If you need to insert a literal+
in the query string, then it must be encoded as%2B
(re: RFC2396 §2.2).