Re: [css-syntax] i18n-ISSUE-306: reference to space character

On Wed, Jan 15, 2014 at 8:06 AM, Richard Ishida <ishida@w3.org> wrote:
> On 07/01/2014 23:31, Simon Sapin wrote:
>> http://www.w3.org/International/track/issues/306
>>>>
>>>>  where XXX is a sequence of bytes other than 22 (ASCII for ")
>>>
>>> This is unclear and looks odd. [...]
>>
>>
>> In this rephrasing, I also avoid entirely mentioning the 0x22 ASCII
>> character. The details of the byte pattern are not central to this note.
>
> Actually, i think there's still a problem here. If the @charset 'thing' is
> to be useful (ie. recognised for fallback encoding), then it has to follow a
> precise syntax, ie. a single space between charset and quote mark, and
> double quotes used rather than single.
>
> That isn't expressed by the grammar
>
>         <at-charset-rule> = @charset <string>;

That's because the grammar for the @charset rule follows normal CSS
conventions, where you can use arbitrary whitespace, use either quote
character for strings, add comments, etc.

The grammar for the @charset has no connection whatsoever with the
byte sequence for specifying encoding information (see "The @charset
rule has no effect on a stylesheet").  You can easily create valid
@charset rules which show up in the CSSOM which have no effect on the
document encoding.  Example:

@charset    'iso-8859-1';
.foo© { color: red; }

Totally valid CSSCharsetRule shows up in the stylesheet.  Assuming
that the file is actually saved in iso-8859-1, though, the @charset
has zero effect, and the © symbol is corrupted.  Remove the extra
whitespace, change to double-quote chars, and it'll work.

~TJ

Received on Wednesday, 15 January 2014 22:05:08 UTC