In-depth understanding of URL encoding in the Web, in-depth understanding of weburl

Source: Internet
Author: User

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;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.