22.12.2013 Views

W3C CSS2 Cascading Style Sheets, level 2 - instructional media + ...

W3C CSS2 Cascading Style Sheets, level 2 - instructional media + ...

W3C CSS2 Cascading Style Sheets, level 2 - instructional media + ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

When a style sheet resides in a separate file, user agents must observe the<br />

following priorities when determining a document’s character encoding (from<br />

highest priority to lowest):<br />

1. An HTTP "charset" parameter in a "Content-Type" field.<br />

2. The @charset at-rule.<br />

3. Mechanisms of the language of the referencing document (e.g., in HTML,<br />

the "charset" attribute of the LINK element).<br />

At most one @charset rule may appear in an external style sheet -- it must not<br />

appear in an embedded style sheet -- and it must appear at the very start of the<br />

document, not preceded by any characters. After "@charset", authors specify the<br />

name of a character encoding. The name must be a charset name as described<br />

in the IANA registry (See [IANA]. Also, see [CHARSETS] for a complete list of<br />

charsets). For example:<br />

Example(s):<br />

@charset "ISO-8859-1";<br />

This specification does not mandate which character encodings a user agent<br />

must support.<br />

Note that reliance on the @charset construct theoretically poses a problem<br />

since there is no a priori information on how it is encoded. In practice, however,<br />

the encodings in wide use on the Internet are either based on ASCII, UTF-16,<br />

UCS-4, or (rarely) on EBCDIC. This means that in general, the initial byte values<br />

of a document enable a user agent to detect the encoding family reliably, which<br />

provides enough information to decode the @charset rule, which in turn determines<br />

the exact character encoding.<br />

4.4.1 Referring to characters not represented in a character<br />

encoding<br />

A style sheet may have to refer to characters that cannot be represented in the<br />

current character encoding. These characters must be written as escaped [p. 38]<br />

references to ISO 10646 characters. These escapes serve the same purpose as<br />

numeric character references in HTML or XML documents (see [HTML40], chapters<br />

5 and 25).<br />

The character escape mechanism should be used when only a few characters<br />

must be represented this way. If most of a document requires escaping, authors<br />

should encode it with a more appropriate encoding (e.g., if the document<br />

contains a lot of Greek characters, authors might use "ISO-8859-7" or "UTF-8").<br />

Inter<strong>media</strong>te processors using a different character encoding may translate<br />

these escaped sequences into byte sequences of that encoding. Inter<strong>media</strong>te<br />

processors must not, on the other hand, alter escape sequences that cancel the<br />

special meaning of an ASCII character.<br />

Conforming user agents [p. 32] must correctly map to Unicode all characters in<br />

any character encodings that they recognize (or they must behave as if they did).<br />

For example, a document transmitted as ISO-8859-1 (Latin-1) cannot contain<br />

Greek letters directly: "κουρος" (Greek: "kouros") has to be written as<br />

"\3BA\3BF\3C5\3C1\3BF\3C2".<br />

51

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!