Why garbled: <meta http-equiv= "Content-type" > non-ANSI characters before

Source: Internet
Author: User

Why garbled: <meta http-equiv= "Content-type" > non-ANSI characters before

Browser detects the default order of page character sets

The browser's page character set detection sequence is usually:

    1. CharSet parameter in HTTP Content-type header.
    2. <meta http-equiv= "Content-type" > element in the
    3. BOM (Byte Order Mark).
    4. Auto-detect the character encoding as a last resort.

Note one:HTTP content-type Header If CharSet is specified , the priority is higher than the HTML document <meta http-equiv= " Content-type "> in the CharSet declaration .

Note two: If the HTTP Content-type header does not specify CharSet, and the HTML document <meta http-equiv= "Content-type" > preceded by non-ANSI characters, It is possible that this meta tag will not be parsed , and remember that this issue has occurred in Blogger.com in 2005. As shown, it is a good practice to keep this meta tag before the title, but the Chinese note in the Green font will cause some browsers to no longer detect the character set:

  

Note Three: After the second step, if the character set is not explicitly specified, the browser temporarily takes the default character set. If the default value for the Chinese version of IE is Gb2312,firefox, the default value for the Chinese version is GBK.

Some browsers (such as the IE kernel version of the browser) due to Meta before the Chinese cause unresolved, will use the default character set GB2312 to parse the page , So what you see after the rendering is this garbled:

That is, when you can see clearly garbled Chinese characters or characters arrangement, probably is the browser UTF-8 document as GB2312 parsing.

Why garbled: <meta http-equiv= "Content-type" > non-ANSI characters before

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.