Summarized test results:
CSS encoding

Intended audience: users, XHTML/HTML coders (using editors or scripting), script developers (PHP, JSP, etc.), CSS coders, Web project managers, and anyone who wants to know whether ruby markup works in current browsers.

Updated

These tests check whether a user agent follows the CSS 2.1 specification when dealing with character encodings for CSS style sheets.

Note that the snapshot summaries of these test results are for released versions of the browsers tested. Versions that are still in development may provide better support for these features. The tests themselves do not test any vendor prefixes.

Results

A number of tests could not be fully checked because there was no font on the system to support one or more of the glyphs in the test. These tests were skipped.

To see the test, click on the link in the left-most column. To see detailed results for a single test, click on the link in the right-most column. To submit test data for a single test, click on the link in the right-most column and then follow the link on that page.

The tables show the latest results from the W3C Test Framework. Below the tables are summaries of the results at a given date. The table data may be more up-to-date than the summary. The tables may also contain some incorrectly scored tests, and tests that relate to non-released versions of browsers. These are not included in the summary.

Basic tests

Assertion Gecko Presto Trident WebKit Detailed results
HTTP declaration The user agent respects the encoding of a css stylesheet declared in HTTP.
@charset declaration (lowercase) The user agent respects the encoding of a css stylesheet declared in a lowercase @charset rule.
@charset declaration (uppercase) The user agent respects the encoding of a css stylesheet declared in an uppercase @charset rule.
link charset The user agent respects the encoding of a css stylesheet declared in a charset attribute on the HTML link.
inheritance from HTML encoding The user agent applies the encoding of the HTML file to a css stylesheet whose encoding is not otherwise declared.
CSS has UTF-signature The user agent uses a UTF-8 signature without an @charset at the beginning of a css stylesheet to indicate that the encoding is UTF-8.

Snapshot summary, 2011-02-07

All user agents supported encoding declarations using HTTP, @charset, and a charset attribute on a link. In the absence of any other encoding information, all browsers use a UTF-8 signature at the start of a style sheet to indicate that the style sheet is encoded in UTF-8.

All browsers respect the rule that a CSS file with no encoding declaration assumes the encoding of the HTML file that called it. (This was not the case in earlier versions of Opera, Safari and Chrome.)

CSS unknown encoding

Assertion Gecko Presto Trident WebKit Detailed results
css @charset unknown When a stylesheet has a @charset declaration with an unknown value, the stylesheet should be ignored.

Snapshot summary, 2011-02-07

When a stylesheet has a @charset declaration with an unknown value, the stylesheet should be ignored. Only IE and Firefox actually ignored the stylesheet.

@charset typos

Assertion Gecko Presto Trident WebKit Detailed results
no semicolon at end of charset rule If a @charset declaration is missing a final semicolon, the encoding declaration will not be recognised.
extra spaces after @charset If a @charset declaration has more than one space after 'charset', the encoding declaration will not be recognised.
extra spaces before colon in charset rule If a @charset declaration has spaces just before the colon, the encoding declaration will not be recognised.
linebreak in middle of charset rule If a @charset declaration has a line break in the middle, the encoding declaration will not be recognised.
single quotes around charset name If a @charset declaration value has single, rather than double, quotes around it, the encoding declaration will not be recognised.
blank line before @charset If a @charset declaration is not on the first line of the file, the encoding declaration will not be recognised.
blank spaces before @charset If a @charset declaration does not start at the beginning of the first line of the file (when there is no BOM), the encoding declaration will not be recognised.

These tests are only valid if the @charset rule is recognized by the user agent. The result of that test (css-encoding-005) is shown in the 'Basic tests' table.

Snapshot summary, 2011-02-07

Only Firefox and IE reacted as expected to all the typos tested for the @charset declaration. Safari and Chrome, and especially Opera, ignored several typos, rather than failing to recognize the encoding.

Precedence

Assertion Gecko Presto Trident WebKit Detailed results
http vs. @charset An HTTP encoding declaration for a stylesheet takes precedence over an @charset declaration.
http vs. charset link An HTTP encoding declaration for a stylesheet takes precedence over a charset attribute link declaration.
http vs. bom An HTTP encoding declaration for a stylesheet takes precedence over a UTF-8 signature.
@charset vs. link charset An HTTP encoding declaration for a stylesheet takes precedence over a UTF-8 signature.
css bom and @charset iso15 When a stylesheet has a BOM and a @charset declaration that is not for a Unicode encoding, the stylesheet fails.

These tests are only valid if the relevant HTTP declarations, BOM, @charset rules and charset links have been shown to have an effect. The results for those tests are shown in the 'Basic tests' table, above.

Snapshot summary, 2011-02-07

In terms of precedence between HTTP, BOM, @charset, and a link with a charset attribute, all browsers behaved as expected, except that Safari and Chrome gave higher precedence to a UTF-8 BOM than to an HTTP encoding declaration.

If a file has a UTF-8 signature but has an @charset declaration that indicates that the content of the file is not encoded in UTF-8, the style sheet is ignored, as expected, in Firefox only.