Declaring character encodings in HTML

Menel picture Menel · Jul 8, 2016 · Viewed 9.2k times · Source

Should I declare charset like this:

<meta http-equiv="content-type" content="text/html" charset="utf-8" />

or like this:

<meta http-equiv="content-type" content="text/html; charset=utf-8"/>

Or are both valid?

Answer

Zakaria Acharki picture Zakaria Acharki · Jul 8, 2016

The both declarations are valid, you could always use the short equivalent version :

<meta charset="utf-8" /> 

Hope this helps.