The charset
attribute specifies the character encoding for the HTML document and needs to be a valid character encoding (examples include windows-1252
, ISO-8859-2
, Shift_JIS
, and UTF-8
). UTF-8
(Unicode) is the most widely used and should be used for any new project.
<meta charset="UTF-8">
<meta charset="ISO-8859-1">
All browsers have always recognized the <meta charset>
form, but if you for some reason need your page to be valid HTML 4.01, you can use the following instead:
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
See also the Encoding Standard, to view all available character encoding labels that browsers recognize.