- From: Russ Rolfe <rrolfe@windows.microsoft.com>
- Date: Tue, 23 Sep 2003 15:17:44 -0700
- To: <public-i18n-geo@w3.org>
Here is my submission for this week. Regards, Russ -=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Question? How do I declare the character encoding of a CSS (Cascading Style Sheets) style sheet? Answer: Just as you should always declare the character encoding for an HTML document <http://www.w3.org/TR/1998/REC-html40-19980424/charset.html#h-5.2.2> you should also declare the character encoding for a separate external style sheet file. This way it is not left to chance on how the style sheet's encoding will be interpreted. To set the character encoding you may use the "@charset at-rule". Its syntax is: @charset <IANA defined charset name> The CSS2 specification states: "At most one @charset rule may appear in an external style sheet -- it must not appear in an embedded style sheet -- and it must appear at the very start of the document, not preceded by any characters. After "@charset", authors specify the name of a character encoding. The name must be a charset name as described in the IANA registry (See [IANA]. Also, see [CHARSETS] for a complete list of charsets)." The important thing to note here is that this command must appear at the very beginning of the file -- even before any comments. Thus an example of labeling your CSS file as UTF-8 encoded would be: @charset "UTF-8" References: CSS 2.1 @charset spec http://www.w3.org/TR/CSS21/syndata.html#x60 CSS 2.0 @charset spec http://www.w3.org/TR/CSS2/syndata.html#q23 IANA Charset Names http://www.iana.org/assignments/character-sets HTML 4.0 Specify the Character Encoding http://www.w3.org/TR/1998/REC-html40-19980424/charset.html#h-5.2.2
Received on Tuesday, 23 September 2003 18:17:48 UTC