@charset @-rule is used because when a stylesheet is embedded in a document, its character set encoding is the same as the document it resides in. The at-rule must be followed by a quoted string value and a semicolon; the string must contain a valid encoding name from the IANA registry. If the document contains an external stylesheet, it is assumed to be encoded using Unicode unless otherwise specified. This @-rule syntax allows an author to specify the character set encoding of the stylesheet; it should only be used on external stylesheets. This @-rule is allowed to occur only once in an external stylesheet and it must be the very first statement in the stylesheet. It also supersedes any encoding declarations specified in the document that reference the stylesheet, but should be over-ridden in the event that HTTP character set headers (
charset component of the
content-type syntax) have been specified.