Posted on 2016-03-12 07:30 found that almost all websites now have urlencode operations on Chinese characters and special characters in URLs, namely: http://hi.baidu.com/%BE%B2%D0%C4%C0%CF%C8%CB/ creat/blog/this way, in the middle of the form, it is definitely my login user name. Why do you encode these characters in the form of a character encoding (GBK, UTF8) or in order to not have special characters in the URL? All know to turn, but the real benefit of the turn. Viewed a lot of information on the Internet, and did not find a more accurate statement. URL escaping is only intended to conform to URL specifications. Because Chinese and many characters in the standard URL specification are not allowed to appear in the URL. Take a look at Php's UrlEncode description: The urlencode-encoded URL string UrlEncode (String $str) returns a string in addition to-_. All non-alphanumeric characters are replaced with a percent sign (%) followed by a two-digit hexadecimal number, and a space is encoded as a plus (+). This encoding is the same as the WWW form POST data, and is encoded in the same way as the application/x-www-form-urlencoded media type. For historical reasons, this encoding differs from RFC1738 encoding (see Rawurlencode ()) in terms of encoding spaces as plus signs (+). This function makes it easy to encode a string and use it for the request part of the URL, and it also facilitates the passing of a variable to the next page. What characters are needed for conversion? 1. ASCII control characters These characters are non-printable and naturally require conversion. 2. Some non-ASCII characters these characters are naturally illegal character ranges. Transformation is also a matter of course. 3. Some reserved characters are obviously the most common is "&", if it appears in the URL, then you think it is a character in the URL, or special parameter segmentation? 4. It's just some unsafe characters. For example: spaces. To prevent ambiguity, you need to be converted to "+". Knowing this, you know why you need to convert, and the rules of transformation are simple. According to the character encoding of each character, not in line with our range, all the conversion to% of the form is also. Nature is also 16 in the form of the binary. and character encoding regardless of the conversion rules and purposes of urlencode, it is also easy to see that Urleocode is based on character encoding. The same kanji, different encoding types, certainly correspond to the strings of different urleocode. GBK encoded with GBK Enco.De results. Apache and other servers, after accepting the string, can be decode, but still cannot solve the problem of encoding. Coding problems, or the need to rely on conventions or character coding to solve the judgment. Therefore, Urleocode is only for some non-ASCII characters in the URL, it can be transmitted correctly, as to which encoding to use, it is not encode concern and solve the problem. Coding problem, not urlencode to solve.
Why do I need to encode a URL