# HTML: `charset` Use an ASCII case-insensitive match for the character encoding's label; for example: `UTF-8`. # References [4.2.5. The meta element](https://www.w3.org/TR/2021/SPSD-html52-20210128/document-metadata.html#the-meta-element): > The charset attribute specifies the character encoding used by the > document. This is a character encoding declaration. If the attribute > is present in an XML document, its value must be an ASCII > case-insensitive match for the string "utf-8" (and the document is > therefore forced to use UTF-8 as its encoding). [4.2.5.5. Specifying the document’s character encoding](https://www.w3.org/TR/2021/SPSD-html52-20210128/document-metadata.html#specifying-the-documents-character-encoding): > The character encoding name given must be an ASCII case-insensitive > match for one of the labels of the character encoding used to > serialize the file. [ENCODING] [ENCODING](https://www.w3.org/TR/2021/SPSD-html52-20210128/references.html#biblio-encoding): > Anne van Kesteren, Joshua Bell, Addison Phillips. Encoding. CR. URL: >
redirects to [Encoding](https://encoding.spec.whatwg.org/). For the `UTF-8` encoding, [4.2. Names and labels](https://encoding.spec.whatwg.org/commit-snapshots/75b988c17cc2b90266e69526f399c7916c3e0ef0/#names-and-labels) lists the following labels: > * "unicode-1-1-utf-8" > * "unicode11utf8" > * "unicode20utf8" > * "utf-8" > * "utf8" > * "x-unicode20utf8"
Chat / Q&A
閒聊/問答