JavaScript Tutorial

HTML Charset

HTML Charset, also called HTML Character Sets or HTML Encoding, is used to display an HTML page properly because web browsers need to know which character set to use for displaying anything correctly.

There are various types of character encoding, which are explained below:

ASCII Character Set

ASCII stands for American Standard Code for Information Interchange, and it was the first-ever character encoding standard used in HTML. It provides 128 different alphanumeric characters that can be used on the internet, including numbers (0-9), English letters (A-Z), and some special characters like! $ + - ( ) @ <>.

However, the main problem with ASCII encoding is that it has a limited range of characters, containing mainly 128 characters.

ANSI Character Set

ANSI stands for American National Standard Institute. It is an extended version of the standard ASCII character set that supports 256 characters. ANSI is also known as Windows-1252, and it was the default character set for Windows up to Windows 95.

ISO-8859-1 Character Set

ISO-8859-1 was the default character encoding in HTML 2.0. It is also an extension of the ASCII standard that supports international characters. It uses full bytes (8-bits) to represent characters.

UTF-8 Character Set

UTF-8 is a variable-width character encoding that covers almost all characters and symbols in the world. Originally, ANSI (Windows-1252) was the Windows character set that supported 256 different character codes.

Why UTF 8 is also supported in HTML4?

UTF-8 is also supported in HTML4 because ANSI and ISO-8859-1 were limited. The default character encoding for HTML5 is UTF-8.

To specify the character set in HTML, you can use the following code snippets:

<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"> <meta charset="UTF-8">

Go back to Previous Course