HTML Charsets
HTML Charsets
In order to display an HTML page correctly, the browser must know which charset to use.
The early World Wide Web used the ASCII charset. ASCII supports the digits 0-9, the upper- and lower-case English alphabet, and some special characters.
Complete ASCII Reference Manual.
Since the characters used by many countries are not part of ASCII, the default charset of modern browsers is ISO-8859-1.
Complete ISO-8859-1 Reference Manual.
If a web page uses a charset different from ISO-8859-1, it should be specified in the tag.
ISO Charsets
ISO charsets are standard charsets defined by the International Organization for Standardization (ISO) for different alphabets/languages.
The following lists the different charsets used around the world:
| Character set | Description | Usage Range |
|---|---|---|
| ISO-8859-1 | Latin alphabet part 1 | North America, Western Europe, Latin America, the Caribbean, Canada, Africa |
| ISO-8859-2 | Latin alphabet part 2 | Eastern Europe |
| ISO-8859-3 | Latin alphabet part 3 | SE Europe, Esperanto, and other miscellaneous |
| ISO-8859-4 | Latin alphabet part 4 | Scandinavian/Baltic (and other parts not included in ISO-8859-1) |
| ISO-8859-5 | Latin/Cyrillic part 5 | Languages using the ancient Slavic alphabet, such as Bulgarian, Belarusian, Russian, and Macedonian |
| ISO-8859-6 | Latin/Arabic part 6 | Languages using the Arabic alphabet |
| ISO-8859-7 | Latin/Greek part 7 | Modern Greek, and mathematical symbols derived from Greek |
| ISO-8859-8 | Latin/Hebrew part 8 | Languages using the Hebrew alphabet |
| ISO-8859-9 | Latin 5 part 9 | Turkish. Identical to ISO-8859-1 except that Turkish characters replace some Icelandic letters. |
| ISO-8859-10 | Latin 6 | Lappish, Germanic, and Eskimo Nordic languages |
| ISO-8859-15 | Latin 9 (aka Latin 0) | Similar to ISO 8859-1, with the euro sign and some other characters replacing some less-used symbols |
| ISO-2022-JP | Latin/Japanese part 1 | Japanese |
| ISO-2022-JP-2 | Latin/Japanese part 2 | Japanese |
| ISO-2022-KR | Latin/Korean part 1 | Korean |
The Unicode Standard
Because the charsets listed above all have capacity limits and are incompatible with multilingual environments, the Unicode Consortium developed the Unicode Standard.
The Unicode Standard covers all the characters, punctuation, and symbols in the world.
Regardless of platform, program, or language, Unicode enables the processing, storage, and exchange of text data.
The Unicode Consortium
The Unicode Consortium developed the Unicode Standard. Their goal is to replace existing charsets with the standard Unicode Transformation Format (UTF).
The Unicode Standard has been successful. Unicode has been implemented in XML, Java, ECMAScript (JavaScript), LDAP, CORBA 3.0, and WML. Unicode is also supported in many operating systems and all modern browsers.
The Unicode Consortium cooperates with leading standards-development organizations such as ISO, W3C, and ECMA.
Unicode is compatible with different charsets. The most commonly used encodings are UTF-8 and UTF-16:
| Character set | Description |
|---|---|
| UTF-8 | Characters in UTF-8 can be 1-4 bytes long. UTF-8 can represent any character in the Unicode Standard. UTF-8 is backward compatible with ASCII. UTF-8 is the preferred encoding for web pages and email. |
| UTF-16 | The 16-bit Unicode Transformation Format is a variable-length Unicode character encoding capable of encoding the entire Unicode repertoire. UTF-16 is mainly used in operating systems and environments such as Microsoft's Windows 2000/XP/2003/Vista/CE, and in Java and .NET bytecode environments. |
Tip: The first 256 characters of the Unicode charset correspond to the 256 ISO-8859-1 characters.
Tip: All HTML 4 browsers support UTF-8, and all XHTML and XML processors support UTF-8 and UTF-16!