Skip to main content

HTML Encoding (Character Sets)

By SamK
0
0 recommends
Topic(s)

For proper display of an HTML page, a web browser needs to know the character set to use.

The HTML Charset Attribute

The character set is defined in the <meta> tag.

<meta charset="UTF-8">

The ASCII Character Set

ASCII was the initial character encoding standard for the web, defining 128 distinct characters for internet use, which includes English letters (A-Z), numbers (0-9) and special characters like ! $ + - ( ) @ < >.

The ANSI Character Set

ANSI (Windows-1252) was the original character set for Windows, which is identical to ASCII for the first 127 characters, special characters from 128 to 159 and identical to UTF-8 from 160 to 255.

<meta charset="Windows-1252">

The ISO-8859-1 Character Set

ISO-8859-1 served as the default character set for HTML 4, supporting 256 different character codes. It was identical to ASCII for the first 127 characters, does not use the characters from 128 to 159 and is identical to ANSI and UTF-8 from 160 to 255.

<meta charset="ISO-8859-1">

The UTF-8 Character Set

The UTF-8 is identical to ASCII for the values from 0 to 127, does not use the characters from 128 to 159, is identical to ANSI and 8859-1 from 160 to 255 and continues from the value 256 to 10 000 characters

<meta charset="UTF-8">

The HTML5 specification encourages web developers to utilize the UTF-8 character set, which encompasses nearly all characters and symbols worldwide.

Please check below options for the links to our previous or next tutorial.

Questions & Answers