Today, web host applications for different geographies and languages and different languages use different character sets, or charsets. To inform the browser about character set used in HTML5 document, you need to use the meta tag with attribute name
Let’s see an example of
charset declaration of
<meta charset = "UTF-8" />
If you want to provide the charset information using old manner, then you will use below format. It’s given here for information purpose, and is not recommended.
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
XHTML documents have a third option: to express the character encoding via XML declaration:
<?xml version="1.0" encoding="UTF-8"?>
UTF-8will work in most instances, a lot of developers have found that using
ISO-8859-1as the charset gives even more flexibility.
- Another charset,
UTF-16, sometimes results in wrong characters and, in some cases, applications operating improperly.
- Most modern web browsers feature automatic character encoding detection – if not declared explicitely.
Happy Learning !!