Charset HTML5 – Character Encoding Declaration

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 charset.

charset

Let’s see an example of charset declaration of UTF-8.

I would recommend using UTF-8 wherever possible, since it can represent any character in almost 99.99% cases. It is also well supported by most of the modern browsers.

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.

XHTML documents have a third option: to express the character encoding via XML declaration:

  1. While UTF-8 will work in most instances, a lot of developers have found that using ISO-8859-1 as the charset gives even more flexibility.
  2. Another charset, UTF-16, sometimes results in wrong characters and, in some cases, applications operating improperly.
  3. Most modern web browsers feature automatic character encoding detection – if not declared explicitely.

Happy Learning !!

References:
https://www.w3.org/International/articles/http-charset/index
https://en.wikipedia.org/wiki/Character_encodings_in_HTML
https://codehay.pro

 

Nicholas Andrew

Nicholas Andrew

My name's Quang Trường, from Ha Noi My favorite: Create Website, Software,... Phone: 0862020654 Mail: admin@codehay.pro

3 Replies to “Charset HTML5 – Character Encoding Declaration

Leave a Reply

Your email address will not be published. Required fields are marked *