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

Tab Atkins Jr., Fri, 24 Jan 2014 08:44:34 -0800:

> Every HTML document should include a <meta charset=utf-8> in its head.
>  It's as much a part of a valid document as the doctype, frankly -
> lacking it effectively puts you in "quirky encoding" mode.
> 
> As long as that happens, there's no reason to declare in-band charsets
> on any resource.  They'll either default to utf-8 or pull the encoding
> from the HTML page.

I think there is difference between ”not necessary to write non-UTF-8 
CSS”, on one side, and ”not having to use the CSS @charset”, on the 
other side.

Namely: If you *do* have a site where the HTML files use a legacy 
encoding, you could still switch the CSS files to UTF-8 - without 
simultaneously switching the HTML files to UTF-8, as long as the 
encoding is declared via @charset rule (or via HTTP).

Thus, with regard the situation that Richard described:

Richard Ishida, Fri, 24 Jan 2014 18:23:56 +0000:
> On 24/01/2014 17:06, Anne van Kesteren wrote:

> I spoke with someone this week who works for a company where 100s of 
> developers are still not using UTF-8 due to legacy code and corporate 
> policy issues. They're working to change that, but it takes a while 
> to turn the ship around.

Then, for such situations, it could perhaps be of help knowing that 
they could start their switch to UTF-8 by switching the CSS to UTF-8 
first and that @charset could be of help for that, since the @charset 
"UTF-8" would make the CSS work even if the CSS makes use of non-ASCII 
selectors.

HTML(5) permits <meta charset="UTF-8"/> in XHTML, as long as it 
specifies "UTF-8". And it seems like not recommending @charset in CSS, 
except when it says "UTF-8", could be a similarly decent rule.
-- 
leif halvard silli

Received on Friday, 31 January 2014 05:18:10 UTC