In-depth understanding of URL encoding in the Web, in-depth understanding of weburl
Web development is inseparable from URLs. URLs are URLs. network standards stipulate that only letters and numbers [0-9a-zA-Z] and some special symbols "$-_. +" are allowed! * '(), "[Excluding parentheses], and reserved words can be directly used for URL without encoding.
Therefore, to make our website accessible normally, we often need to encode the URL, that is, the network address, before accessing it. There are two common scenarios:
① When an HTTP request is sent through the Get or Post method;
② When sending a request through ajax;
When an HTTP request is sent through the Get or Post method, there are two main ways to determine the webpage encoding:
First, set the encoding in the header of the page:
<Meta http-equiv = "Content-Type" content = "text/html; charset = xxxx">
Second, set the encoding in the form:
<Form action = "form_action.asp" accept-charset = "xxxx">
When a request is sent via ajax, the encoding is usually handled by the browser. For example, no matter What Character Set Your webpage uses, IE always uses "GB2312" for encoding, firefox and Chrome are always encoded in UTF-8.
Since different request methods and different browsers will lead to changes in the encoding method, what method should we use to avoid the huge trouble caused by different encoding? There is still a solution:
Complete reading> Click me;