[css21][css3-syntax] encoding determination

Hi,

Me, Anne and Henri looked a bit at how encoding determination works for  
CSS and thought that the rules specified in CSS 2.1 make no sense. In  
particular, it requires detection of @charset encoded in UTF-16 to be  
honored (which means that the declaration itself becomes garbage if it  
doesn't specify utf-16). Opera/Firefox and, I'm told, IE, do that, but  
Chrome doesn't. We came up with a draft (well, Anne wrote it) for how we  
think it should work instead, at:

http://html5.org/temp/cssencoding.txt

Step 5 says

[[
5. Set encoding to the encoding of the referring style sheet or document,  
if
    any, and only if that encoding is not utf-16 or utf-16be.
]]

I'd like to remove ", and only if that encoding is not utf-16 or utf-16be"  
since Opera/Chrome/Firefox don't do that and there doesn't appear to be  
any security problem with doing it.

Opera and Firefox seem to detect between BOMless big/little endian UTF-16  
when the page's encoding is UTF-16, while Chrome inherits the same  
endianness as the page. It would be nice to do away with detection of  
endianness UTF-16, but on the other hand it seems reasonably simple to  
specify if it turns out to be necessary for compat with Web content.

I have submitted tests for the above draft with the proposed change for  
inheriting UTF-16.

https://test.csswg.org/source/contributors/opera/submitted/css3-syntax/charset/

I would appreciate if anyone could test them in IE (both old and new  
versions are interesting).

http://dev.w3.org/csswg/css3-syntax/#the-input-byte-stream currently has  
an old version of the draft; Tab said (in person) he'd update it.

I don't want to present the draft and tests as a fait accompli, though I  
think it makes sense, it tries to align with the rules HTML uses while not  
doing anything that *no* browser already does.

cheers,
-- 
Simon Pieters
Opera Software

Received on Tuesday, 30 October 2012 11:04:09 UTC