reprinted from: http://www.ruanyifeng.com/blog/2010/02/url_encoding.html
One. The origin of the problem. URL is the URL, as long as the Internet is bound to use. In general, URLs can use only English letters, Arabic numerals, and certain punctuation marks, and cannot use other text or symbols. For example, the world has the English alphabet URL, http://www.xyz.com ' But there is no Greek URL for http://aerfa,beita,segma.com. This is because the networkStandard RFC 1738 makes the hard rules: only letters and numbers [0-9a-za-z], some special symbols $-_.+!*'(), and some reserved words, can be used without encoding directly for URLsThis means that if there is a Chinese character in the URL, it must be encoded and used. But the trouble is that rfc_1738 does not prescribe specific coding methods, but instead gives it to the application ' browser ' to decide. This causes URL encoding to become a chaotic area. Let's see how confusing the URL code is. I'll analyze four different situations in turn, and in each case, the browser's encoding method is not the same. After explaining their differences, I'll say how to use JavaScript to find a unified coding method. 1, http://zh.wikipedia.org/wiki/Spring FestivalConclusion 1: The code of the URL is UTF8 encoded .2, http://www.baidu.com/s?wd= Spring FestivalConclusion 2: The query string is encoded using the default encoding of the operating system. 3, in the browser directly enter the Spring festival Baidu Google conclusion 3:get and post method encoding, with the page encoding4, the URL of the AJAX call contains the kanji Ex:url=url+"? q="+ document.form.getelements[0].value.//Suppose the expression is submitted for the Spring Festival. Http_request.open ('GET'Urltrue); Conclusion 4: In Ajax calls, IE always uses GB2312 encoding (i.e. the operating system default encoding), and Firefox always uses UTF-8 encoding.
Confusing URL encoding