Define XHTML language Encoding

Source: Internet
Author: User
Tags definition require

The third step is to define your language code, similar to this:

<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>

In order to be properly interpreted and validated by the browser, all XHTML documents must declare the encoding language they use, we generally use gb2312 (Simplified Chinese), the production of multi-language pages may also use Unicode, iso-8859-1, etc., according to your needs to define.

This is usually the way to define it. But to add that the XML document does not define language encoding in this way, XML is defined as follows:

<?xml version= "1.0" encoding= "gb2312"?>

You can see similar statements in the first line of Macromedia.com's home code, which is also the recommended definition for the consortium. So why don't we just take this approach? The reason is that some browsers have imperfect support for standards, and do not correctly understand such definitions, such as ie6/windows. So under the current transition programme, we still recommend using meta methods. Of course, you can write both ways.

Look at this site source code, you will find that the language code definition of the place more than one sentence:

<meta http-equiv= "Content-language" content= "gb2312"/>

This is written for older browsers to ensure that the pages are interpreted correctly by various browsers.

Note: At the end of the statement above, you see a slash "/", which is different from our previous HTML4.0 code. The reason is that the XHTML grammar rules require that all identities must have a start and an end. For example, <body> and </body>, <p> and </p>, for a pair of identifiers, require a space in the logo and then a "/". For example <br> written <br/>, written as , and the reason for the space is to avoid the code linked to the browser does not recognize.

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.