HTML Charsets
To display an HTML page correctly, the browser must know the character set (character encoding) to use.
HTML Charsets
What is the correct character encoding in HTML?
The default character encoding in HTML5 is UTF-8.
This was not always the case. Early web character encoding was ASCII.
Later, from HTML 2.0 to HTML 4.01, ISO-8859-1 was recognized as the standard.
With the advent of XML and HTML5, UTF-8 finally arrived, solving a large number of character encoding problems.
Below is a brief overview of character encoding standards.
In the beginning: ASCII
Computer information (numbers, text, images) is stored electronically in binary 1s and 0s (01000101).
To standardize the storage of alphanumeric characters, ASCII (short for American Standard Code for Information Interchange) was created. It defines a unique 7-bit binary number for each stored character, supporting the digits 0-9, upper- and lowercase English letters (a-z, A-Z), and some special characters such as ! $ + - ( ) @ < > 。
Because ASCII uses one byte (7 bits to represent the character, 1 bit for transmission parity control), it can represent only 128 different characters. Of these, 32 are reserved for other control purposes.
The biggest drawback of ASCII is that it excludes non-English letters.
ASCII is still widely used today, especially in large computer systems.
To learn more about ASCII, seeComplete ASCII Reference Manual。
In Windows: ANSI
ANSI (also known as Windows-1252) was the default character set in Windows 95 and earlier Windows systems.
ANSI is an extension of ASCII that adds international characters. It uses a full byte (8 bits) to represent 256 different characters.
Since ANSI became the default character set in Windows, all browsers support ANSI.
To learn more about ANSI, seeComplete ANSI Reference Manual。
In HTML 4: ISO-8859-1
Because most countries use characters beyond ASCII, in the HTML 2.0 standard the default character encoding was changed to ISO-8859-1.
ISO-8859-1 is an extension of ASCII that adds international characters. Like ANSI, it uses a full byte (8 bits) to represent 256 different characters.
![]() |
When a browser detects ISO-8859-1 on a web page, it usually defaults to ANSI, because apart from ANSI's 32 extra characters, ANSI is essentially identical to ISO-8859-1. |
|---|
If an HTML 4 page uses a character set other than ISO-8859-1, it needs to be specified in the tag, as shown below:
Example
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-8">|
|
The default character set in HTML5 is UTF-8.
All HTML 4 processors support UTF-8, and all HTML5 and XML processors support both UTF-8 and UTF-16.
To learn more about ISO-8859-1, seeComplete ISO-8859-1 Reference Manual。
In HTML5: Unicode (UTF-8)
Because the character sets listed above are limited and incompatible in multilingual environments, the Unicode Consortium developed the Unicode Standard.
The Unicode Standard covers (almost) all characters, punctuation marks, and symbols.
Unicode makes text processing, storage, and transport independent of platform and language.
The default character encoding in HTML5 is UTF-8.
To learn more about Unicode (UTF-8), seeComplete Unicode Reference Manual。