2.1.14 [CSS-Level2-2009] Section 4.4, CSS style representation

V0008:

The specification states:

 When a style sheet resides in a separate file, user agents must observe the 
 following priorities when determining a style sheet's character encoding (from 
 highest priority to lowest): 
  
 1. An HTTP "charset" parameter in a "Content-Type" field (or similar parameters in 
 other protocols)
 2. BOM and/or @charset (see below)
 3. <link charset=""> or other metadata from the linking mechanism (if any)
 4. charset of referring style sheet or document (if any)
 5. Assume UTF-8

Quirks Mode and IE7 Mode (All Versions)

The priorities are identical, but they follow a different sequence:

  1. BOM and/or @charset

  2. Charset of referring style sheet or document (if any)

  3. <link charset=""> or other metadata from the linking mechanism (if any) – the Link charset attribute does not override the referring document’s codepage

  4. An HTTP "charset" parameter in a "Content-Type" field (or similar parameters in other protocols) – the HTTP charset does not override anything but the default

  5. Assume UTF-8

All Document Modes (All Versions)

An external style sheet is not abandoned when it starts with a Unicode byte order mark (for example, EF BB BF) and a conflicting ISO @charset declaration. Instead, the style sheet is parsed based on the @charset declaration.

The charset attribute on a link element is ignored.

V0009:

The specification states:

 If the encoding is detected based on one of the entries in the table above marked 
 "as specified", the user agent ignores the style sheet if it does not parse an 
 appropriate @charset rule at the beginning of the stream of characters resulting 
 from decoding in the chosen @charset. This ensures that: -@charset rules should 
 only function if they are in the encoding of the style sheet,-byte order marks are 
 ignored only in encodings that support a byte order mark, and-encoding names cannot 
 contain newlines.

Quirks Mode and IE7 Mode (All Versions)

UTF-16BE and UTF-16LE are not properly supported, but the style sheet is not ignored. Instead, unknown UTF-16BE/LE encodings are converted to UTF-16 and then interpreted as UTF-16.

Show: