Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

HTML character set


May 04, 2021 HTML Reference Manual


Table of contents


HTML character set


HTML character set

To display the HTML page correctly, the browser must know what character set to use. The browser uses the character set you specify to decode HTML files to avoid garbled code.

The character set used earlier on the World Wide Web was ASCII. ASCII supports 0-9 numbers, capital and lowercase Alphabets, and some special characters.

Complete ASCII reference manual.

Since the characters used in many countries do not belong to ASCII, the default character set for modern browsers is ISO-8859-1.

Complete ISO-8859-1 reference manual.

If a Web page uses a character set different from ISO-8859-1, it should be specified in the label.


ISO character set

An ISO character set is a standard character set defined by the International Standards Organization (ISO) for different alphabets/languages.

ISO-8859-1 is the default character set for most browsers.

The following is a list of the different character sets used around the world:

字符集 描述 使用范围
ISO-8859-1 Latin alphabet part 1 北美、西欧、拉丁美洲、加勒比海、加拿大、非洲
ISO-8859-2 Latin alphabet part 2 东欧
ISO-8859-3 Latin alphabet part 3 SE Europe、世界语、其他杂项
ISO-8859-4 Latin alphabet part 4 斯堪的纳维亚/波罗的海(以及其他没有包括在 ISO-8859-1 中的部分)
ISO-8859-5 Latin/Cyrillic part 5 使用古代斯拉夫语字母表的语言,比如保加利亚语、白俄罗斯文、俄罗斯语、马其顿语
ISO-8859-6 Latin/Arabic part 6 使用阿拉伯字母的语言
ISO-8859-7 Latin/Greek part 7 现代希腊语,以及由希腊语衍生的数学符号
ISO-8859-8 Latin/Hebrew part 8 使用希伯来语的语言
ISO-8859-9 Latin 5 part 9 土耳其语。除了土耳其字符取代了冰岛文字,其它与 ISO-8859-1 相同。
ISO-8859-10 Latin 6 拉普兰语、日耳曼语、爱斯基摩北欧语
ISO-8859-15 Latin 9 (aka Latin 0) 与 ISO 8859-1 类似,欧元符号和其他一些字符取代了一些较少使用的符号
ISO-2022-JP Latin/Japanese part 1 日本语
ISO-2022-JP-2 Latin/Japanese part 2 日本语
ISO-2022-KR Latin/Korean part 1 韩语


Unicode standard

Because the character sets listed above have capacity limitations and are not compatible with multilingual environments, the Unicode Alliance has developed the Unicode standard.

The Unicode standard covers all characters, punctuation, and symbols in the world.

Unicode is capable of processing, storing, and exchanging text data, regardless of platform, program, or language.

That is, the Unicode standard includes all characters in one collection, and as long as the computer supports this character set, it can display all characters without garbled.

The Unicode standard starts at 0 and specifies a number for each symbol, called code point.


Unicode Alliance

The Unicode Alliance has developed the Unicode standard. Their goal is to replace existing character sets with standard Unicode conversion formats (UTFs).

The Unicode standard has been successful, and Unicode has been implemented in XML, Java, ECMAScript, LDAP, CORBA 3.0, WML. Unicode is also supported in many operating systems and all modern browsers.

The Unicode Alliance collaborates with leading standard development organizations such as ISO, W3C, and ECMA.

Unicode can be compatible with different character sets. The most common encoding methods are UTF-8 and UTF-16:

字符集 描述
UTF-8 UTF8 中的字符可以是 1-4 个字节长。UTF-8 可以表示 Unicode 标准中的任意字符。UTF-8 向后兼容 ASCII。UTF-8 是网页和电子邮件的首选编码。
UTF-16 16 比特的 Unicode 转换格式是一种 Unicode 可变字符编码,能够对全部 Unicode 指令表进行编码。UTF-16 主要被用于操作系统和环境中,比如微软的 Windows 2000/XP/2003/Vista/CE 以及 Java 和 .NET 字节代码环境。

Tip: The top 256 Unicode character set characters correspond to 256 ISO-8859-1 characters.

Tip: All HTML 4 processors already support UTF-8, while all XHTML and XML processors support UTF-8 and UTF-16!