charset
Summary
The charset attribute is used to declare the character encoding of the document.
Applies to | [HTMLMetaElement](/dom/HTMLMetaElement) |
---|
Note that BOM and declaration in the HTTP header take precedence over in-document declaration.
It’s good practice to declare the character encoding inside the document for situations when the document will be used locally with no HTTP header involved, and as a visual cue in the source code.
Examples
<meta charset="utf-8"/>
Related specifications
- HTML Document Representation
- W3C Recommendation