After the Chinese urlencode, each % XX represents a byte, right? Therefore, the result of urlencode (& #039; & #039;) is % XX (UTF-8 encoded). each % XX represents one byte, is that true?
Therefore, the urlencode (in ') is % XX (UTF-8 encoding)
Reply content:
After the Chinese urlencode, each % XX represents a byte, right?
Therefore, the urlencode (in ') is % XX (UTF-8 encoding)
Yes. in order to solve the problem that unicode occupies too much memory space and expansion remains unchanged, the UTF-8 specification emerged.
-
For a single-byte symbol, the first byte is set to 0, and the last seven digits are the unicode code of this symbol. Therefore, for English letters, the UTF-8 encoding and ASCII code are the same.
-
For the n-byte symbol (n> 1), the first n bits of the first byte are set to 1, and the nth + 1 bits are set to 0, the first two bytes are set to 10. The remaining unmentioned binary bits are all unicode codes of this symbol.
That is to say, the UTF-8 encoding result is longer.
MediumUTF-8 encoding isE4B8AD, So the urlencode is%E4%B8%AD.
Yes, the URL encoding simply represents the data of special characters and non-ASCII characters in hexadecimal notation, and adds a percent sign before each byte (that is, two hexadecimal numbers. URL encoding for non-special ASCII characters is itself.
In the same word, if it is GBK encoding is two bytes, if it is UTF-8 is three bytes.
Of course, the trouble is that the URL encoding is chaotic. For example+To indicate spaces.%20To analyze the specific situation. The former corresponds to the functionurlencodeWhich correspondsrawurlencode. Usually, the former is used in form data (including the query in the URL, that is?The latter part is used in the URL path (the part before the host query)