This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
The current state of css-syntax is a bit unclear when it comes to authoring conformance for @charset. http://dev.w3.org/csswg/css-syntax/#input-byte-stream does not say anything is a parse error/syntax error. http://dev.w3.org/csswg/css-syntax/#parse-a-stylesheet removes the first rule if it's @charset. So it seems to me the following stylesheet parses without errors: @charset { LOL } foo { } This seems bad at least for CSS validators but maybe also browser devtools that log CSS errors. Note that HTML has some authoring conformance requirements on <meta charset> that are not parse errors in the parser section: https://html.spec.whatwg.org/multipage/semantics.html#character-encoding-declaration
So I guess some authoring conformance criteria along the lines of "it's invalid to write a @charset rule that doesn't get recognized by the algorithm in this section" in #input-byte-stream?
That's a bit vague, and maybe not helpful enough for implementors wanting accurate errors in the console. e.g. what about @charset "utf-16"; ? is whitespace in the string OK? What if HTTP charset is given and @charset says a different encoding? etc.