HTML Meta Character Set

HTML5 specifications encourage everyone to use the UTF-8 character set, which covers almost all the characters and symbols available in the world as of today.

Character Set defines what kind of characters are allowed on an HTML web page. 

Specifying a character set in an HTML page makes it use any kind of character and symbol associated with that character set.

So, including the right character set is very important.

HTML <meta> can be used to define the character set of an HTML document as shown below.

<meta charset="UTF-8">

To know more about different types of character sets, take a look at the below article.

Example

<!doctype html>
<html lang="en">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta charset="UTF-8">
</head>
<body>
    <h1>HTML Meta Character Set</h1>
    <p>ABCDEFGHIJKLMNOPQRSTUVWXYZ</p>
    <p>abcdefghijklmnopqrstuvwxyz</p>
    <p>1234567890</p>
    <p>~!@#$%^&*()_+{}[]:";'?,./</p>
    <p>Some of the UTF-8 non-alphanumeric characters: &#8704; &#8706; &#8707; &#8709;</p>
    
    <a href="https://www.fileformat.info/info/charset/UTF-8/list.htm">UTF-8 Characters Reference</a>
</body>
</html>

Overall

We now know the importance of specifying a character set using a meta tag in an HTML document.