Web development is inseparable from Url,url is the Web site, network standards: only letters and numbers [0-9a-za-z], some special symbols "$-_. + ! * ' (), "[does not include double brackets], and some reserved words can be used without encoding directly for URLs.
Therefore, in order for our URLs to be able to access the normal, we often need to url--that is the network address, encoding and then access, there are two common situations:
① when an HTTP request is sent via the Get or post method;
② when sending requests via Ajax;
When sending an HTTP request via the Get or post method, there are two main ways to determine the encoding of the Web page:
One is to set the code on the head of the page:
<meta http-equiv= "Content-type" content= "text/html;charset=xxxx" >
The second is to set the encoding in the form:
<form action= "form_action.asp" accept-charset= "xxxx" >
When sending requests through Ajax, the encoding is usually handled by the browser, for example, no matter what character set your Web page uses, ie always uses "GB2312" to encode, and Firefox, Chrome always uses "UTF-8" to encode.
Now that the request is different and the browser is different, it will lead to a change in encoding, so what should we do to avoid the great trouble of coding the difference? In fact, there are ways to:
Full read >> Click me;
Deep understanding of URL encoding in the Web