W3C home > Mailing lists > Public > www-style@w3.org > January 2014

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

From: Richard Ishida <ishida@w3.org>
Date: Wed, 22 Jan 2014 19:11:29 +0000
Message-ID: <52E017E1.8020908@w3.org>
To: "Tab Atkins Jr." <jackalmage@gmail.com>, Zack Weinberg <zackw@panix.com>
CC: www-style list <www-style@w3.org>, www International <www-international@w3.org>
[putting back the cc to www-international, so that the i18n community 
and our tracker sees this]

This wording is a significant improvement. Thanks.

RI


PS: I'm curious, however, about why the parsing of the initial bytes is 
so draconian in requiring specific quotes and exactly one space. HTML5 
doesn't require that, afaict.



On 15/01/2014 22:18, Tab Atkins Jr. wrote:
> 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, 22 January 2014 19:12:00 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 22 January 2014 19:12:01 UTC