For each of these tests the HTML file links to a CSS stylesheet saved in ISO 8859-1 and containing the following rule: p.ýäȸ { background-color: #00FF00; font-weight: bold; color: white; font-family: Arial, Helvetica, sans-serif; }, where the class name is the following sequence of bytes: C3 BD C3 A4 C8 B8. This byte sequence yields different characters in ISO 8859-1 and ISO 8859-15, and is equivalent to a different string in UTF-8. By varying the encoding information related to the CSS file, the sequence of bytes is stored in the user agent using one of three different Unicode sequences, which are then tested for in the HTML.

1 HTTP

Objective: Does the user agent respect the encoding of a CSS file declared in HTTP?

The CSS file has no @charset or BOM, but the encoding is declared using the HTTP header.

Click on each link, and check that on each resulting page the text describes its background color. If not, the test has failed..

Test for ISO 8859-1

Test for ISO 8859-15

Test for UTF-8

2 @charset

Objective: Does the user agent respect encoding information in the @charset rule?

The CSS file is served with no HTTP encoding information or BOM, but contains an @charset rule to indicate its encoding.

Click on each link, and check that on each resulting page the text describes its background color. If not, the test has failed..

Test for ISO 8859-1

Test for ISO 8859-15

Test for UTF-8

3 link charset

Objective: Does the user agent respect encoding information in the link element?

The CSS file is served with no encoding information or BOM, but the HTML link element contains a charset attribute to indicate its encoding.

Click on each link, and check that on each resulting page the text describes its background color. If not, the test has failed..

Test for ISO 8859-1

Test for ISO 8859-15

Test for UTF-8

4 inherited

Objective: Does the user agent use the encoding of the HTML file in the absence of any other information?

The CSS file is served with no encoding information or BOM, but the HTML files are in three different encodings.

Click on each link, and check that on each resulting page the text describes its background color. If not, the test has failed..

Test for ISO 8859-1

Test for ISO 8859-15

Test for UTF-8

5 default to UTF-8

Objective: Does the user agent default to UTF-8 in the absence of any other information?

The HTML and CSS files are served with no encoding information or BOM.

Click on the link, and check that on each resulting page the text describes its background color. If not, the test has failed..

Test

6 BOM

Objective: Does the user agent default to UTF-8 in the absence of any other information than a byte-order mark?

The HTML and CSS files are served with no encoding information but the CSS starts with a BOM.

Click on each link, and check that on each resulting page the text describes its background color. If not, the test has failed..

Test

Test

7 BOM with @charset

Objective: Does the user agent recognize the @charset rule when there is also a byte-order mark?

The HTML and CSS files are served with no encoding information but the CSS starts with a BOM and has an @charset rule specifying a non-UTF-8 encoding.

Click on each link, and check that on each resulting page the text describes its background color. If not, the test has failed..

Test

Test

8 Non-initial @charset

Objective: Does the user agent recognize the @charset rule when it is not the first line in the style sheet?

The CSS file is served with no encoding information other than an @charset rule specifying a non-UTF-8 encoding on the second line.

Click on each link, and check that on each resulting page the text describes its background color. If not, the test has failed..

Test

9 HTTP vs. @charset

Objective: Does the user agent treat HTTP encoding declarations as higher priority than the @charset rule?

The CSS file is served with an @charset rule specifying a different encoding to that in the HTTP header.

Click on each link, and check that on each resulting page the text describes its background color. If not, the test has failed..

Test

Test

10 @charset vs. link charset

Objective: Does the user agent treat @charset encoding declarations as higher priority than link charset attributes?

The CSS file is served with an @charset rule specifying a different encoding to that in the link attribute of the HTML.

Click on each link, and check that on each resulting page the text describes its background color. If not, the test has failed..

Test

Test

Version: $Id: test-encoding-detection-6.html,v 1.2 2008/08/08 16:51:34 rishida Exp $