I recently used urlencode to encode the string and found that it encodes the space string to +. However, if you use rawurlencode to encode the string, the space string will change to % 20. After a space is entered in the browser, it will convert it to % 20. What is the difference between the two? Backend server...
I recently usedurlencode
When encoding a string, it is found that it encodes the space string+
But if you userawurlencode
To encode the space string.%20
. After entering a space in the browser, it will convert it%20
.
What is the difference between the two? What are the differences between backend servers when they accept these two encoding requests?
I triedhttp://zh.wikipedia.org/wiki/Internet%20Explorer%207
Replace the URLhttp://zh.wikipedia.org/wiki/Internet+Explorer+7
And cannot be identified.
Reply content:
I recently usedurlencode
When encoding a string, it is found that it encodes the space string+
But if you userawurlencode
To encode the space string.%20
. After entering a space in the browser, it will convert it%20
.
What is the difference between the two? What are the differences between backend servers when they accept these two encoding requests?
I triedhttp://zh.wikipedia.org/wiki/Internet%20Explorer%207
Replace the URLhttp://zh.wikipedia.org/wiki/Internet+Explorer+7
And cannot be identified.
From Wikipedia (emphasis and link added ):
When data that has been entered into HTML forms is submitted, the form field names and values are encoded and sent to the server in an HTTP request message using method GET or POST, or, historically, via email.
The encoding used by default is 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 way is 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...