-
Notifications
You must be signed in to change notification settings - Fork 382
Description
Themes sometimes include a @charset at-rule. For example, in the Twenty Nineteen theme under development it is getting added by the SASS generator:
This rule is not valid in AMP because styles must be in the style[amp-custom] element and per MDN, @charset…
cannot be used inside a style attribute on an HTML element or inside the
<style>element where the character set of the HTML page is relevant.
Since AMP requires UTF-8, all documents are going to be using this character encoding. When a document doesn't, we'll need to convert it (#855). The meta[charset] will be indicating the encoding, and the @charset is irrelevant and illegal.
We need to check how PHP-CSS-Parser is handling character encodings, if it is reading the @charset to determine the encoding and the internal encoding it uses. Bottom line is that we need the externally-fetched stylesheet to end up as UTF-8, and we need to drop the @charset.