Introducing Character Sets and Encodings(字符集与编码介绍)
This page introduces you to key internationalization topics and tasks, and directs you towards articles or resources that will take you on the next step of your journey. After reading these resources, you can find more detailed information using the topic index.
This page is not yet stable, and has not gone through wide review. It will be added to and improved over time. Please send comments to the www-international list.
What is it?(什么是字符集和编码)
A character set is a collection of letters and symbols used in a writing system, eg. the ASCII character set covers letters and symbols for English text, ISO-8859-6 covers letters and symbols needed for many languages based on the Arabic script, and Unicode contains characters for most of the living languages and scripts in the world.
Characters in a character set are stored as one or more bytes in a computer. Each byte or sequence of bytes represents a given character. A character encoding is the key that maps a particular byte or sequence of bytes to particular characters that the font renders as text.
There are many different character encodings. If the wrong encoding is applied to the bytes in memory, the result will be unintelligible text. It is therefore important that the character encoding used for content is correctly labelled if you want people to be able to read it.
Essential definitions. Unicode, character sets, coded character sets, character encodings, the document character set, and character escapes.
Choosing an encoding(选择编码)
Everyone developing content, whether content authors or programmers, must decide what character encoding to use. UTF-8 is a popular recommendation these days, but there may still be things you should consider before using it.
v Choosing an encoding. Advice on choosing encodings.
v Upgrading from language-specific legacy encoding to Unicode encoding. What you should consider when upgrading my web pages from legacy encoding to a Unicode encoding.
Using an encoding(使用编码)
Once it has been decided what encoding to use, content developers and programmers must ensure that it is declared in the right way.
v Character sets & encodings in XHTML, HTML and CSS. How to declare encodings in these languages.
v CSS character encoding declarations. How to declare encoding in CSS style sheets.
With a technology such as XHTML, encoding declarations are not always straightforward; they require an understanding of 'standards' vs. 'quirks' modes, and the impact of the XML declaration.
v Serving XHTML 1.0. How do XHTML & MIME types, 'Standards' vs 'Quirks' modes, and the XML declaration influence encoding declarations?
You must also ensure that your data is saved in the encoding you have chosen, it is not sufficient to just label it.
v Setting encoding in web authoring applications. How to set character encoding in my web authoring application.
v Changing (X)HTML page encoding to UTF-8. How to change the encoding of my (X)HTML pages to UTF-8.
Content developers and webmasters may also need to ensure that the server delivers content with the correct character encoding declarations.
v The HTTP charset parameter. How to send encoding information in the HTTP header.
v Setting 'charset' information in .htaccess. How to use .htaccess directives on an Apache server to serve files with a specific encoding.
Escapes are a way of representing a character using only ASCII text. They provide a way of representing characters that are not available in the character encoding you are using, or a way of avoiding the use of the character for other reasons (such as when they may conflict with syntax). You should be clear on when and how these escapes should be used.
v Using character entities and NCRs. What are character entities and NCRs, and when to use them.
These days Web addresses can also include non-ASCII characters. The user does little other than click on the appropriate link or enter the text as they see it, the heavy lifting is done by the user agent, but you may be interested to know how this works.