Re: [css-syntax] ISSUE-329: @charset has no effect on stylesheet??

On Wed, Jan 15, 2014 at 2:11 PM, Zack Weinberg <zackw@panix.com> wrote:
> I think the text in the note is good, but the lead-in still gives the
> wrong impression.  Let me try again.
>
> | The @charset rule is an artifact of the algorithm used to [determine
> | the fallback encoding] for the stylesheet.  That algorithm looks for
> | a specific byte sequence as the very first few bytes in the file, which
> | has the syntactic form of an @-rule. Those bytes are not discarded
> | from the input, whether or not they influence the encoding actually
> | used to process the stylesheet. Therefore, the stylesheet parser
> | recognizes an @-rule with the general syntax
> |
> |    <at-charset-rule> = @charset <string> ;
> |
> | and, for backward compatibility, includes it in the object model for
> | the stylesheet.  Modifying, adding, or removing an @charset rule via
> | the object model has no effect (in particular it does *not* cause the
> | stylesheet to be rescanned in a different encoding).
> |
> | The @charset rule is invalid if it is not the very first, top-level
> | rule in the stylesheet, but it is parsed according to the normal
> | syntax for @-rules, which are less restrictive than the algorithm that
> | determines the fallback encoding.  Therefore, an @charset rule may
> | appear in the object model even if it was ignored by that algorithm.
> | (For instance, if it was written with extra whitespace or with single
> | rather than double quotes.)

Ooh, I like this wording. Stealing it!

~TJ

Received on Wednesday, 15 January 2014 22:18:48 UTC