Skip to content

Doesn't flag invalid @charset when @charset follows BOM #249

@dd8

Description

@dd8

The @charset pattern should only be recognised at position zero in the file - @charset anywhere else (including after the BOM) is invalid/ignored.

https://drafts.csswg.org/css-syntax/#input-byte-stream

If the first 1024 bytes of the stream begin with the hex sequence
40 63 68 61 72 73 65 74 20 22 XX* 22 3B

This file flags no errors and starts with the UTF-8 BOM:
ef bb bf 40 63 68 61 72 73 65 74 20 22 55 54 46 |...@charset "UTF|
http://test.csswg.org/suites/css21_dev/20110323/html4/support/at-charset-014.css

These files flag no errors and start with the UTF-16LE BOM:
ff fe 40 00 63 00 68 00 61 00 72 00 73 00 65 00 |..@.c.h.a.r.s.e.|
http://test.csswg.org/suites/css21_dev/20110323/html4/support/at-charset-015.css
http://test.csswg.org/suites/css21_dev/20110323/html4/support/at-charset-060.css

This file flags no errors and starts with the UTF-16BE BOM:
fe ff 00 40 00 63 00 68 00 61 00 72 00 73 00 65 |...@.c.h.a.r.s.e|
http://test.csswg.org/suites/css21_dev/20110323/html4/support/at-charset-016.css

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions