Charset in HTML | Lesson28 HTML Tutorial
HTML CHARSET IMAGE

Charset in HTML | Lesson28 HTML Tutorial

This lesson explain what are the Charset in HTML and where we could define them and what is the mean purpose of charset.
Generally there is three type of charset: ASCII , ISO, UTF, and ANSI.

This Is a Visual Explain for the Same Lesson:

Charset in HTML Video

Character Encoding Type

ASCII was the first character encoding standard (also called character set). ASCII defined 128 different alphanumeric characters that could be used on the internet: numbers (0-9), English letters (A-Z), and some special characters like ! $ + – ( ) @ < > .

ANSI (Windows-1252) was the original Windows character set, with support for 256 different character codes.

ISO-8859-1 was the default character set for HTML 4. This character set also supported 256 different character codes.

Because ANSI and ISO-8859-1 were so limited, HTML 4 also supported UTF-8.

Tip: UTF-8 (Unicode) is most common used because it covers almost all of the characters and symbols in the world languages. Also this charset type is the default of HTML5 encoding.

HTML charset Attribute

To display an HTML page correctly, a web browser must know the character set used in the page. Which could be specified in the web page header inside the <meta> tag:

Example in HTML5:

 <meta charset="UTF-8"> 

Example in HTML4:

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

What Is the Different Between Character Sets?

The differences could be in the way of displaying some characters of some languages like Indian, or Arabic characters.

ASCII Character Set

ASCII uses the values from 0 to 31 (and 127) for control characters. Also ASCII uses the values from 32 to 126 for letters, digits, and symbols, but ASCII does not use the values from 128 to 255.

ANSI Character Set (Windows-1252)

ANSI is identical to ASCII for the values from 0 to 127. Also ANSI has a proprietary set of characters for the values from 128 to 159. ANSI also is identical to UTF-8 for the values from 160 to 255.

ISO-8859-1 Character Set

8859-1 is identical to ASCII for the values from 0 to 127. 8859-1 does not use the values from 128 to 159. But 8859-1 is identical to UTF-8 for the values from 160 to 255.

Finally ISO-8859-1 Character Set

8859-1 is identical to ASCII for the values from 0 to 127. But 8859-1 does not use the values from 128 to 159. 8859-1 is identical to UTF-8 for the values from 160 to 255.

Defining Charset in CSS

We can define the charset type in CSS by @charset rule to specify the character encoding used in a style sheet.

Fore Example:

 @charset "UTF-8"; 



This post is one of the HTML5 for deep understanding course. where we will learn every common elements from basic to the advanced element.

In addition each lesson has a video which you could visit and watch for more practicing and for deep understanding.

We hope that we could give the best for you and for the deep and easy understanding.

You could follow the series from our website SAFHATECH.com and go to categories and then programming and then Choose the course you want then just click next post to go step by step.

Finally we hope every thing is works as you suspect.


Consequently You could follow us at :

Website URL: https://www.safhatech.com/

Youtube: https://www.youtube.com/channel/UCIVzh6iykNowNcOUT5Gfasw

Twitter: http:// https://twitter.com/safhatech

Instegram: https://www.instagram.com/safhatech

Facebook: http:// https://www.facebook.com/Safhatech-487171875443687

Phone:967772223681

References: w3schools.com

Leave a Reply