I recently found that urlencode
when I encode a string, it encodes the space string in order +
, but if you rawurlencode
encode it, the space string becomes %20
. And when you enter a space in the browser, it will convert it to %20
.
What is the difference between the two? Will the backend server be different when accepting both of these encoding requests?
I tried to http://zh.wikipedia.org/wiki/Internet%20Explorer%207
replace the URL with a discovery that was http://zh.wikipedia.org/wiki/Internet+Explorer+7
not recognized.
Reply content:
I recently found that urlencode
when I encode a string, it encodes the space string in order +
, but if you rawurlencode
encode it, the space string becomes %20
. And when you enter a space in the browser, it will convert it to %20
.
What is the difference between the two? Will the backend server be different when accepting both of these encoding requests?
I tried to http://zh.wikipedia.org/wiki/Internet%20Explorer%207
replace the URL with a discovery that was http://zh.wikipedia.org/wiki/Internet+Explorer+7
not recognized.
From Wikipedia (emphasis and link added):
When
data was been entered into HTML forms was submitted, the form field names and values are encoded and sent T o the server in an HTTP request message using method GET or POST, or, historically, via email.
the encoding used by default are based on a very early version of the general URI percent-encoding rules, with a number of modifications such as newline normalization and replacing spaces with "+" instead of "%20". The MIME type of data encoded this to application/x-www-form-urlencoded, and it is currently defined (still in a very Outdated manner) in the HTML and XForms specifications.
Source:
HTTP://STACKOVERFLOW.COM/QUESTIONS/16 ...
Other references:
HTTP://STACKOVERFLOW.COM/QUESTIONS/12 ...