Test Cases for HTTP Content-Type handling

Please send feedback to julian.reschke@gmx.de.

Note: Work-in-progress

See draft-ietf-appsawg-mime-default-charset.

Test Result Summary

Colors -- Red: Failure, Green: Pass, Yellow: Warning, Grey: Not Supported

Score -- Passes: 2 points, Warning: 1 point, in percent of possible points (this should be updated to count optional features differently)

Test CaseFirefox 18Microsoft IE 9Opera 12Safari 5.1Konqueror 4.7.2Google Chrome 22
Summary80% passes, 20% failures, 0% warnings, 0% unsupported, 0% to-do
Score: 80
67% passes, 27% failures, 7% warnings, 0% unsupported, 0% to-do
Score: 70
87% passes, 13% failures, 0% warnings, 0% unsupported, 0% to-do
Score: 87
87% passes, 13% failures, 0% warnings, 0% unsupported, 0% to-do
Score: 87
73% passes, 20% failures, 7% warnings, 0% unsupported, 0% to-do
Score: 77
80% passes, 20% failures, 0% warnings, 0% unsupported, 0% to-do
Score: 80
Charset Defaultingtextplainnodefaultutf8passpasspasspasspasspass
textplainnodefaultiso88591passpasspasspasspasspass
textxmlnodefaultutf8fail (detects charset from payload) fail (detects charset from payload) fail (detects charset from payload) fail (detects charset from payload) fail (detects charset from payload) fail (detects charset from payload)
textxmlnodefaultutf8nodeclfail (detects charset from payload (defaulting to UTF-8 in absence of XML declaration)) fail (detects charset from payload (defaulting to UTF-8 in absence of XML declaration)) passpasspasspass
textxmlnodefaultiso88591passpasspasspasspasspass
textxmlnodefaultiso88591nodeclfail (attempts to parse with no charset information and fails because ISO-8859-1 is not an autodetected encoding in XML) fail (empty window) passpasspasspass
Charset Parsingtextplainutf8passpasspasspasspasspass
textplainutf8wspass (charset parameter ignored) warn (charset used) pass (charset parameter ignored) pass (charset parameter ignored) warn (charset used) pass (charset parameter ignored)
textplainutf8qspasspasspasspasspasspass
textplainutf8qsapasspasspasspassfail (detects UTF-8) fail (detects UTF-8 (see Chrome Issue 103361))
textplainutf8qsescapedpassfail (doesn't process the escape and falls back to ISO-8859-1) fail (doesn't process the escape and falls back to ISO-8859-1) fail (doesn't process the escape and falls back to ISO-8859-1) fail (doesn't process the escape and falls back to ISO-8859-1) fail (doesn't process the escape and falls back to ISO-8859-1)
textplainutf8extparampasspasspasspasspasspass
textplainutf8extparamqspasspasspasspasspasspass
textplainutf8extparamqs1passpasspasspasspasspass
textplainutf8extparamsqpasspasspasspasspasspass

Test Cases

Charset Defaulting

Various tests checking charset defaulting.

textplainnodefaultutf8 [TEST] [R]

Content-Type: text/plain

Payload, encoded in UTF-8:

Umlaute: 漩周 Euro: €
Test Results
FF18pass
MSIE9pass
Operapass
Safaripass
Konqpass
Chromepass

text/plain, no charset given, body encoded in UTF-8

Default according to RFC 2616 is ISO-8859-1, so we expect the UTF-8 sequences to display as sequence as raw bytes (as in Umlaute: 盲枚眉...) (but see HTTPbis ticket #20)

Result for this UA:

textplainnodefaultiso88591 [TEST] [R]

Content-Type: text/plain

Payload, encoded in ISO-8859-1:

Umlaute: 漩周
Test Results
FF18pass
MSIE9pass
Operapass
Safaripass
Konqpass
Chromepass

text/plain, no charset given, body using ISO-8859-1

Default according to RFC 2616 is ISO-8859-1, so we expect the text to display correctly (but see HTTPbis ticket #20)

Result for this UA:

textxmlnodefaultutf8 [TEST] [R]

Content-Type: text/xml

Payload, encoded in UTF-8:

<?xml version="1.0" encoding="UTF-8"?>
<foo>Umlaute: 漩周 Euro: €</foo>
Test Results
FF18fail (detects charset from payload)
MSIE9fail (detects charset from payload)
Operafail (detects charset from payload)
Safarifail (detects charset from payload)
Konqfail (detects charset from payload)
Chromefail (detects charset from payload)

text/xml, no charset given, body using UTF-8 (and declaring so)

Default according to RFC 2616 is ISO-8859-1, so we expect the UTF-8 sequences to display as raw bytes (but see HTTPbis ticket #20).

Apparently, specs need to change here.

Result for this UA:

textxmlnodefaultutf8nodecl [TEST] [R]

Content-Type: text/xml

Payload, encoded in UTF-8:

<foo>Umlaute: 漩周 Euro: €</foo>
Test Results
FF18fail (detects charset from payload (defaulting to UTF-8 in absence of XML declaration))
MSIE9fail (detects charset from payload (defaulting to UTF-8 in absence of XML declaration))
Operapass
Safaripass
Konqpass
Chromepass

text/xml, no charset given, body using UTF-8 (and not declaring so)

Default according to RFC 2616 is ISO-8859-1, so we expect the UTF-8 sequences to display as raw bytes (but see HTTPbis ticket #20).

Apparently, specs need to change here.

Result for this UA:

textxmlnodefaultiso88591 [TEST] [R]

Content-Type: text/xml

Payload, encoded in ISO-8859-1:

<?xml version="1.0" encoding="ISO-8859-1"?>
<foo>Umlaute: 漩周</foo>
Test Results
FF18pass
MSIE9pass
Operapass
Safaripass
Konqpass
Chromepass

text/xml, no charset given, body using ISO-8859-1 (and declaring so)

Default according to RFC 2616 is ISO-8859-1, so we expect the text to display correctly

Result for this UA:

textxmlnodefaultiso88591nodecl [TEST] [R]

Content-Type: text/xml

Payload, encoded in ISO-8859-1:

<foo>Umlaute: 漩周</foo>
Test Results
FF18fail (attempts to parse with no charset information and fails because ISO-8859-1 is not an autodetected encoding in XML)
MSIE9fail (empty window)
Operapass
Safaripass
Konqpass
Chromepass

text/xml, no charset given, body using ISO-8859-1 (and declaring so)

Default according to RFC 2616 is ISO-8859-1, so we expect the text to display correctly (but see HTTPbis ticket #20).

Result for this UA:

Charset Parsing

Various tests checking charset parsing.

textplainutf8 [TEST] [R]

Content-Type: text/plain; charset=UTF-8

Payload, encoded in UTF-8:

Umlaute: 漩周 Euro: €
Test Results
FF18pass
MSIE9pass
Operapass
Safaripass
Konqpass
Chromepass

text/plain, charset UTF-8, body using UTF-8

Result for this UA:

textplainutf8ws [TEST] [R]

Content-Type: text/plain; charset = UTF-8

Payload, encoded in UTF-8:

Umlaute: 漩周 Euro: €
Test Results
FF18pass (charset parameter ignored)
MSIE9warn (charset used)
Operapass (charset parameter ignored)
Safaripass (charset parameter ignored)
Konqwarn (charset used)
Chromepass (charset parameter ignored)

text/plain, charset UTF-8, whitespace around "=", body using UTF-8

Result for this UA:

textplainutf8qs [TEST] [R]

Content-Type: text/plain; charset="UTF-8"

Payload, encoded in UTF-8:

Umlaute: 漩周 Euro: €
Test Results
FF18pass
MSIE9pass
Operapass
Safaripass
Konqpass
Chromepass

text/plain, charset UTF-8 (quoted), body using UTF-8

Result for this UA:

textplainutf8qsa [TEST] [R]

Content-Type: text/plain; charset='UTF-8'

Payload, encoded in UTF-8:

Umlaute: 漩周 Euro: €
Test Results
FF18pass
MSIE9pass
Operapass
Safaripass
Konqfail (detects UTF-8)
Chromefail (detects UTF-8 (see Chrome Issue 103361))

text/plain, charset in single quotes, which according to the specs does not match "UTF-8" (it's "'UTF-8'"), body using UTF-8

Result for this UA:

textplainutf8qsescaped [TEST] [R]

Content-Type: text/plain; charset="UTF-\8"

Payload, encoded in UTF-8:

Umlaute: 漩周 Euro: €
Test Results
FF18pass
MSIE9fail (doesn't process the escape and falls back to ISO-8859-1)
Operafail (doesn't process the escape and falls back to ISO-8859-1)
Safarifail (doesn't process the escape and falls back to ISO-8859-1)
Konqfail (doesn't process the escape and falls back to ISO-8859-1)
Chromefail (doesn't process the escape and falls back to ISO-8859-1)

text/plain, charset UTF-8 (quoted, using quoted-string escapes), body using UTF-8

Result for this UA:

textplainutf8extparam [TEST] [R]

Content-Type: text/plain; foo=bar; charset="UTF-8"

Payload, encoded in UTF-8:

Umlaute: 漩周 Euro: €
Test Results
FF18pass
MSIE9pass
Operapass
Safaripass
Konqpass
Chromepass

text/plain, charset UTF-8 (quoted), with extension parameter before charset parameter, body using UTF-8

Result for this UA:

textplainutf8extparamqs [TEST] [R]

Content-Type: text/plain; foo="\""; charset="UTF-8"

Payload, encoded in UTF-8:

Umlaute: 漩周 Euro: €
Test Results
FF18pass
MSIE9pass
Operapass
Safaripass
Konqpass
Chromepass

text/plain, charset UTF-8 (quoted), with extension parameter using quoted-string syntax before charset parameter, body using UTF-8

Result for this UA:

textplainutf8extparamqs1 [TEST] [R]

Content-Type: text/plain; foo="; charset=\"UTF-8\""

Payload, encoded in UTF-8:

Umlaute: 漩周 Euro: €
Test Results
FF18pass
MSIE9pass
Operapass
Safaripass
Konqpass
Chromepass

text/plain, extension parameter using quoted-string, with charset param appearing as text content in the extension parameter's value, body using UTF-8

UTF-8 is not declared, so the ISO-8859-1 default should apply, thus UTF-8 sequences should appear as multiple characters

Result for this UA:

textplainutf8extparamsq [TEST] [R]

Content-Type: text/plain; foo='; charset="UTF-8"

Payload, encoded in UTF-8:

Umlaute: 漩周 Euro: €
Test Results
FF18pass
MSIE9pass
Operapass
Safaripass
Konqpass
Chromepass

text/plain, charset UTF-8 (quoted), with extension parameter using a single quote in the token format before charset parameter, body using UTF-8

Result for this UA:

Test Case Generation

Both this document and the indiviual test "scripts" are generated from one single XML source (httpcontenttype.xml), using an XSLT2 transformation (httpcontenttype.xslt).

To generate the files, an XSLT2 processor such as Saxon 9 is needed. Copy both files into an empty directory, then run:

saxon9 httpcontenttype.xml httpcontenttype.xslt > index.html

Note that this will also generate a set of "asis" files that contain the actual test cases. These can be served using the Apache httpd mod_asis module.