attribute specifies the character encoding used by the document. In
<a href=#html5 title=HTML5>HTML documents</a> this is a <a href=#character-encoding-declaration>character
encoding declaration</a>. If the attribute is present in an <a href=#xhtml5 title=XHTML>XML document</a>, its value must be an <a href=#ascii-case-insensitive>ASCII
case-insensitive</a> match for the string "<code title="">UTF-8</code>", and the resource must be encoded using the
UTF-8 character encoding. (The element has no effect in XML
documents, and is only allowed to facilitate migration to and from
XHTML.)</p>
attribute specifies the character encoding used by the
document. This is a <a href=#character-encoding-declaration>character encoding declaration</a>. If
the attribute is present in an <a href=#xhtml5 title=XHTML>XML
document</a>, its value must be an <a href=#ascii-case-insensitive>ASCII
case-insensitive</a> match for the string "<code title="">UTF-8</code>" (and the document is therefore required to
attribute on the <code><a href=#meta>meta</a></code> element has no effect in XML
documents, and is only allowed in order to facilitate migration to
and from XHTML.</p>
<p>There must not be more than one <code><a href=#meta>meta</a></code> element with a
<code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code> attribute per
<!-- XXX maybe the rest should move to "writing html" section,
though if we do then we have to duplicate the requirements in the
parsing section for conformance checkers -->
parsing section for conformance checkers, and we have to make sure
that the requirements for charset="" apply even in XML, for the
polyglot hack -->
<p>A <dfn id=character-encoding-declaration>character encoding declaration</dfn> is a mechanism by
which the character encoding used to store or transmit a document is
declaration must be serialised completely within the first 512
bytes of the document.</li>
</ul><p>If the document does not start with a BOM, and if its encoding is
not explicitly given by <a href=#content-type-0 title=Content-Type>Content-Type
metadata</a>, then the character encoding used must be an
<a href=#ascii-compatible-character-encoding>ASCII-compatible character encoding</a>, and, in addition,
if that encoding isn't US-ASCII itself, then the encoding must be
specified using a <code><a href=#meta>meta</a></code> element with a <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code> attribute or a
</ul><p>If an <a href=#html-documents title="HTML documents">HTML document</a> does not
start with a BOM, and if its encoding is not explicitly given by
<a href=#content-type-0 title=Content-Type>Content-Type metadata</a>, then the
character encoding used must be an <a href=#ascii-compatible-character-encoding>ASCII-compatible character
encoding</a>, and, in addition, if that encoding isn't US-ASCII
itself, then the encoding must be specified using a
<code><a href=#meta>meta</a></code> element with a <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code> attribute or a
<code><a href=#meta>meta</a></code> element in the <a href=#attr-meta-http-equiv-content-type title=attr-meta-http-equiv-content-type>Encoding declaration
state</a>.</p>
<p>If the document contains a <code><a href=#meta>meta</a></code> element with a <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code> attribute or a
<p>If an <a href=#html-documents title="HTML documents">HTML document</a> contains
a <code><a href=#meta>meta</a></code> element with a <code title=attr-meta-charset><a href=#attr-meta-charset>charset</a></code> attribute or a
<code><a href=#meta>meta</a></code> element in the <a href=#attr-meta-http-equiv-content-type title=attr-meta-http-equiv-content-type>Encoding declaration
state</a>, then the character encoding used must be an
<a href=#ascii-compatible-character-encoding>ASCII-compatible character encoding</a>.</p>