CodesJava

Easy learning with example program codes

HTML Charset

HTML Charset or HTML Character Sets or HTML Encoding is used to specify which character set to use. It is necessary for displaying an HTML page properly and correctly. The character set is specified in the <meta> tag:

Example:

<meta charset="UTF-8">

Types of HTML Charset or HTML Character Sets or HTML Encoding:

Various types of Character Encoding are used in HTML, including:

ASCII Character Set:

The American Standard Code for Information Interchange or ASCII is also the first-ever character encoding standard used in HTML. With 128 different alphanumeric characters including, numbers (0-9), English letters (A-Z), and some special characters like! $ + – ( ) @ <>, ASCII encoding still contains a limited range of characters.

ANSI Character Set:

The American National Standard Institute or ANSI is an extended version of the standard ASCII character set. This character set standard supports 256 character set and was also the default character set for Windows up to Windows 95, and is often called as Windows-1252.

ISO-8859-1 Character Set:

Being the default character set in HTML 2.0, the ISO-8859-1 character set uses full bytes (8-bits) to show characters and is also an extension of ASCII standard with International characters.

UTF-8 Character Set:

UTF-8 covers almost all of the characters and symbols in the world. It is a variable width character encoding. ANSI being the original Windows character set, supporting 256 different character codes. Similarly, the ISO-8859-1 being the default character set for HTML 4, also supported 256 different character codes, but still, ANSI and ISO-8859-1 were so limited that HTML 4 also supported UTF-8. This explains why the default character encoding for HTML5 is UTF-8.

HTML4 UTF-8 syntax:

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

HTML5 UTF-8 syntax:

<meta charset="UTF-8">

Syntax to set the encoding of the style sheet to Unicode UTF-8:

@charset "UTF-8";
Please follow and like us:
error
Posted in HTML   









Copyright © 2019 CodesJava DMCA.com Protection Status