Different charsets include ASCII, ANSI, ISO-8859-1, UTF-8, etc. ISO-8859-1 supports 256 different character codes. ASCII defined 128 different alphanumeric characters. The charset attribute in HTML is used with the <meta> to specify the character encoding.
Following is the syntax −
<meta charset="char_set">
Above, char_set is the character set to specify the character encoding of an HTML document.
Let us now see an example to implement HTML character encoding −
Example
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> </head> <body> <h2>Example</h2> <p>We have added demo text −</p> <textarea rows="4" cols="50"> Here, we are mentioned the demo content. This is just to display an example of charset in an HTML document. </textarea> <br> <button type="button">Previous</button> <button type="button">Next</button> </body> </html>