Test Cases for data: URI handling

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

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 30Microsoft IE 11Safari 5.1Konqueror 4.7.2Google Chrome 35
Summary85% passes, 12% failures, 4% warnings, 0% unsupported, 0% to-do
Score: 87
8% passes, 4% failures, 0% warnings, 88% unsupported, 0% to-do
Score: 8
69% passes, 27% failures, 4% warnings, 0% unsupported, 0% to-do
Score: 71
46% passes, 42% failures, 4% warnings, 0% unsupported, 8% to-do
Score: 48
65% passes, 31% failures, 4% warnings, 0% unsupported, 0% to-do
Score: 67
plain textsimplepassunsupportedpasspasspass
simplewfragpassunsupportedfail (treats fragment as part of the payload (see Webkit bug 68089)) fail (treats fragment as part of the payload) fail (treats fragment as part of the payload (see Chrome Issue 123004))
defaultencoding1pass (uses ISO-8859-1) unsupportedpass (uses ISO-8859-1) warn (tries to decode as UTF-8, shows replacement character) pass (uses ISO-8859-1)
defaultencoding2pass (uses ISO-8859-1, so displays two characters) unsupportedpass (uses ISO-8859-1, so displays two characters) pass (uses UTF-8) pass (uses ISO-8859-1, so displays two characters)
text/plain charset parsingsimple-utf8-nodecpass (apparently sniffs UTF-8) unsupportedpass (apparently handled with ISO-8859-1 default) pass (apparently handled with UTF-8 default) pass (apparently handled with ISO-8859-1 default)
simple-iso8859-1-nodecpass (apparently sniffs ISO-8859-1) unsupportedpass (apparently handled with ISO-8859-1 default) pass (apparently handled with UTF-8 default) pass (apparently handled with ISO-8859-1 default)
simple-iso8859-7-nodecpass (apparently sniffs ISO-8859-1) unsupportedpass (apparently handled with ISO-8859-1 default) pass (apparently handled with UTF-8 default) pass (apparently handled with ISO-8859-1 default)
simple-utf8-decpassunsupportedpasspasspass
simple-iso8859-1-decpassunsupportedpassfail (apparently handled with UTF-8 default) pass
simple-iso8859-7-decpassunsupportedpassfail (apparently handled with UTF-8 default) pass
simple-utf8-dec-sqpass (apparently sniffs UTF-8) unsupportedpass (apparently handled with ISO-8859-1 default) pass (apparently sniffs UTF-8) pass (apparently handled with ISO-8859-1 default)
simple-iso8859-1-dec-sqpass (apparently sniffs ISO-8859-1) unsupportedpass (apparently handled with ISO-8859-1 default) fail (apparently handled with UTF-8 default) pass (apparently handled with ISO-8859-1 default)
simple-iso8859-7-dec-sqpass (apparently sniffs ISO-8859-1) unsupportedpass (apparently handled with ISO-8859-1 default) fail (apparently handled with UTF-8 default) pass (apparently handled with ISO-8859-1 default)
simple-utf8-dec-dqpassunsupportedpasspassfail (decoded as ISO-8859-1)
simple-iso8859-1-dec-dqpassunsupportedpassfail (apparently handled with UTF-8 default) pass
simple-iso8859-7-dec-dqfail (decoded as ISO-8859-1 (see Mozilla Bug 746550)) unsupportedpassfail (apparently handled with UTF-8 default) fail (decoded as as ISO-8859-1)
simple-utf8-dec-dq-escapedpassunsupportedfail (treated as ISO-8859-1) passfail (treated as ISO-8859-1)
simple-iso8859-1-dec-dq-escapedpassunsupportedpassfail (apparently handled with UTF-8 default) pass
simple-iso8859-7-dec-dq-escapedfail (decoded as ISO-8859-1 (see Mozilla Bug 746550)) unsupportedfail (treated as ISO-8859-1) fail (apparently handled with UTF-8 default) fail (treated as ISO-8859-1)
HTMLsimplenofragpassunsupportedpasspasspass
simplefragpassunsupportedfail (treats fragment as part of the payload) fail (treats fragment as part of the payload) fail (treats fragment as part of the payload)
SVGsvgpasspassfail (considers the fragid as content and fails with XML WF error) fail (considers the fragid as content and fails with XML WF error) fail (considers the fragid as content and fails with XML WF error (but works when entered into the location bar))
extension parametersext-simplepasspasspasspasspass
ext-simple-qsfail (fails to parse quoted-string value (see Mozilla Bug 746550)) fail (fails to parse quoted-string value) fail (fails to parse quoted-string value) passfail (fails to parse quoted-string value)
base64parampassunsupportedfail (get's confused and assumes a "base64" extension flag) pass
base64extwrongposwarn (detects base64 encoding (but see Mozilla Bug 781693)) unsupportedwarn (detects base64 encoding) warn (detects base64 encoding)

Test Cases

plain text

Various tests for data URIs using the default content type of text/plain;charset=US-ASCII.

simple [TEST]

URI: data:,test
Test Results
FF30pass
MSIE11unsupported
Safaripass
Konqpass
Chromepass

Result for this UA:

simplewfrag [TEST]

URI: data:,test#foo
Test Results
FF30pass
MSIE11unsupported
Safarifail (treats fragment as part of the payload (see Webkit bug 68089))
Konqfail (treats fragment as part of the payload)
Chromefail (treats fragment as part of the payload (see Chrome Issue 123004))

Result for this UA:

defaultencoding1 [TEST]

URI: data:,test%20%a3%20pound%20sign
Test Results
FF30pass (uses ISO-8859-1)
MSIE11unsupported
Safaripass (uses ISO-8859-1)
Konqwarn (tries to decode as UTF-8, shows replacement character)
Chromepass (uses ISO-8859-1)

...containing a sign encoded in ISO-8859-1

Result for this UA:

defaultencoding2 [TEST]

URI: data:,test%20%c2%a3%20pound%20sign
Test Results
FF30pass (uses ISO-8859-1, so displays two characters)
MSIE11unsupported
Safaripass (uses ISO-8859-1, so displays two characters)
Konqpass (uses UTF-8)
Chromepass (uses ISO-8859-1, so displays two characters)

...containing a sign encoded in UTF-8

Result for this UA:

text/plain charset parsing

Various tests for data URIs using text/plain with variations of charset declarations.

simple-utf8-nodec [TEST]

URI: data:text/plain,test%20%c2%a3%20pound%20sign
Test Results
FF30pass (apparently sniffs UTF-8)
MSIE11unsupported
Safaripass (apparently handled with ISO-8859-1 default)
Konqpass (apparently handled with UTF-8 default)
Chromepass (apparently handled with ISO-8859-1 default)

text/plain with no charset (default should be US-ASCII), UTF-8 encoded text

Result for this UA:

simple-iso8859-1-nodec [TEST]

URI: data:text/plain,test%20%a3%20pound%20sign
Test Results
FF30pass (apparently sniffs ISO-8859-1)
MSIE11unsupported
Safaripass (apparently handled with ISO-8859-1 default)
Konqpass (apparently handled with UTF-8 default)
Chromepass (apparently handled with ISO-8859-1 default)

text/plain with no charset (default should be US-ASCII), ISO-8859-1 encoded text

Result for this UA:

simple-iso8859-7-nodec [TEST]

URI: data:text/plain,test%20%d3%20sigma
Test Results
FF30pass (apparently sniffs ISO-8859-1)
MSIE11unsupported
Safaripass (apparently handled with ISO-8859-1 default)
Konqpass (apparently handled with UTF-8 default)
Chromepass (apparently handled with ISO-8859-1 default)

text/plain with no charset (default should be US-ASCII), ISO-8859-7 encoded text

Result for this UA:

simple-utf8-dec [TEST]

URI: data:text/plain;charset=utf-8,test%20%c2%a3%20pound%20sign
Test Results
FF30pass
MSIE11unsupported
Safaripass
Konqpass
Chromepass

text/plain charset utf-8, UTF-8 encoded text

Result for this UA:

simple-iso8859-1-dec [TEST]

URI: data:text/plain;charset=iso-8859-1,test%20%a3%20pound%20sign
Test Results
FF30pass
MSIE11unsupported
Safaripass
Konqfail (apparently handled with UTF-8 default)
Chromepass

text/plain charset iso-8859-1, ISO-8859-1 encoded text

Result for this UA:

simple-iso8859-7-dec [TEST]

URI: data:text/plain;charset=iso-8859-7,test%20%d3%20sigma
Test Results
FF30pass
MSIE11unsupported
Safaripass
Konqfail (apparently handled with UTF-8 default)
Chromepass

text/plain charset iso-8859-7, ISO-8859-7 encoded text

Result for this UA:

simple-utf8-dec-sq [TEST]

URI: data:text/plain;charset=%27utf-8%27,test%20%c2%a3%20pound%20sign
Test Results
FF30pass (apparently sniffs UTF-8)
MSIE11unsupported
Safaripass (apparently handled with ISO-8859-1 default)
Konqpass (apparently sniffs UTF-8)
Chromepass (apparently handled with ISO-8859-1 default)

text/plain charset 'utf-8', UTF-8 encoded text

Result for this UA:

simple-iso8859-1-dec-sq [TEST]

URI: data:text/plain;charset=%27iso-8859-1%27,test%20%a3%20pound%20sign
Test Results
FF30pass (apparently sniffs ISO-8859-1)
MSIE11unsupported
Safaripass (apparently handled with ISO-8859-1 default)
Konqfail (apparently handled with UTF-8 default)
Chromepass (apparently handled with ISO-8859-1 default)

text/plain charset 'iso-8859-1', ISO-8859-1 encoded text

Result for this UA:

simple-iso8859-7-dec-sq [TEST]

URI: data:text/plain;charset=%27iso-8859-7%27,test%20%d3%20sigma
Test Results
FF30pass (apparently sniffs ISO-8859-1)
MSIE11unsupported
Safaripass (apparently handled with ISO-8859-1 default)
Konqfail (apparently handled with UTF-8 default)
Chromepass (apparently handled with ISO-8859-1 default)

text/plain charset 'iso-8859-7', ISO-8859-7 encoded text

Result for this UA:

simple-utf8-dec-dq [TEST]

URI: data:text/plain;charset=%22utf-8%22,test%20%c2%a3%20pound%20sign
Test Results
FF30pass
MSIE11unsupported
Safaripass
Konqpass
Chromefail (decoded as ISO-8859-1)

text/plain charset "utf-8", UTF-8 encoded text

Result for this UA:

simple-iso8859-1-dec-dq [TEST]

URI: data:text/plain;charset=%22iso-8859-1%22,test%20%a3%20pound%20sign
Test Results
FF30pass
MSIE11unsupported
Safaripass
Konqfail (apparently handled with UTF-8 default)
Chromepass

text/plain charset "iso-8859-1", ISO-8859-1 encoded text

Result for this UA:

simple-iso8859-7-dec-dq [TEST]

URI: data:text/plain;charset=%22iso-8859-7%22,test%20%d3%20sigma
Test Results
FF30fail (decoded as ISO-8859-1 (see Mozilla Bug 746550))
MSIE11unsupported
Safaripass
Konqfail (apparently handled with UTF-8 default)
Chromefail (decoded as as ISO-8859-1)

text/plain charset "iso-8859-7", ISO-8859-7 encoded text

Result for this UA:

simple-utf8-dec-dq-escaped [TEST]

URI: data:text/plain;charset=%22%5cu%5ct%5cf%5c-%5c8%22,test%20%c2%a3%20pound%20sign
Test Results
FF30pass
MSIE11unsupported
Safarifail (treated as ISO-8859-1)
Konqpass
Chromefail (treated as ISO-8859-1)

text/plain charset "\u\t\f\-\8", UTF-8 encoded text

Result for this UA:

simple-iso8859-1-dec-dq-escaped [TEST]

URI: data:text/plain;charset=%22%5ci%5cs%5co%5c-%5c8%5c8%5c5%5c9%5c-%5c1%22,test%20%a3%20pound%20sign
Test Results
FF30pass
MSIE11unsupported
Safaripass
Konqfail (apparently handled with UTF-8 default)
Chromepass

text/plain charset "\i\s\o\-\8\8\5\9\-\1", ISO-8859-1 encoded text

Result for this UA:

simple-iso8859-7-dec-dq-escaped [TEST]

URI: data:text/plain;charset=%22%5ci%5cs%5co%5c-%5c8%5c8%5c5%5c9%5c-%5c7%22,test%20%d3%20sigma
Test Results
FF30fail (decoded as ISO-8859-1 (see Mozilla Bug 746550))
MSIE11unsupported
Safarifail (treated as ISO-8859-1)
Konqfail (apparently handled with UTF-8 default)
Chromefail (treated as ISO-8859-1)

text/plain charset "\i\s\o\-\8\8\5\9\-\7", ISO-8859-7 encoded text

Result for this UA:

HTML

Various tests for data URIs using text/html.

simplenofrag [TEST]

URI: data:text/html,%3Cp%3Efoo%3C%2Fp%3E
Test Results
FF30pass
MSIE11unsupported
Safaripass
Konqpass
Chromepass

Result for this UA:

simplefrag [TEST]

URI: data:text/html,%3Cp%3Efoo%3C%2Fp%3E#bar
Test Results
FF30pass
MSIE11unsupported
Safarifail (treats fragment as part of the payload)
Konqfail (treats fragment as part of the payload)
Chromefail (treats fragment as part of the payload)

Result for this UA:

SVG

Various tests for data URIs using image/svg+xml.

svg [TEST]

URI: data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%3E%0A%20%20%3Ccircle%20cx%3D%22100%22%20cy%3D%22100%22%20r%3D%2225%22%20stroke%3D%22black%22%20stroke-width%3D%221%22%20fill%3D%22green%22%2F%3E%0A%3C%2Fsvg%3E%0A#bar
Test Results
FF30pass
MSIE11pass
Safarifail (considers the fragid as content and fails with XML WF error)
Konqfail (considers the fragid as content and fails with XML WF error)
Chromefail (considers the fragid as content and fails with XML WF error (but works when entered into the location bar))

...an SVG resource with a fragment identifier

Result for this UA:

extension parameters

Various tests for data URIs using media type extensions

ext-simple [TEST]

URI: data:image/svg+xml;foo=bar,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%3E%0A%20%20%3Ccircle%20cx%3D%22100%22%20cy%3D%22100%22%20r%3D%2225%22%20stroke%3D%22black%22%20stroke-width%3D%221%22%20fill%3D%22green%22%2F%3E%0A%3C%2Fsvg%3E%0A
Test Results
FF30pass
MSIE11pass
Safaripass
Konqpass
Chromepass

Result for this UA:

ext-simple-qs [TEST]

URI: data:image/svg+xml;foo=%22bar,bar%22,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%3E%0A%20%20%3Ccircle%20cx%3D%22100%22%20cy%3D%22100%22%20r%3D%2225%22%20stroke%3D%22black%22%20stroke-width%3D%221%22%20fill%3D%22green%22%2F%3E%0A%3C%2Fsvg%3E%0A
Test Results
FF30fail (fails to parse quoted-string value (see Mozilla Bug 746550))
MSIE11fail (fails to parse quoted-string value)
Safarifail (fails to parse quoted-string value)
Konqpass
Chromefail (fails to parse quoted-string value)

Result for this UA:

base64param [TEST]

URI: data:text/plain;base64=paramvalue,test
Test Results
FF30pass
MSIE11unsupported
Safarifail (get's confused and assumes a "base64" extension flag)
Chromepass

...containing a parameter called "base64". Should be ignored, as it's not a valid "base64" extension flag per RFC 2397.

Result for this UA:

base64extwrongpos [TEST]

URI: data:text/plain;base64;x=y,dGVzdA0K
Test Results
FF30warn (detects base64 encoding (but see Mozilla Bug 781693))
MSIE11unsupported
Safariwarn (detects base64 encoding)
Chromewarn (detects base64 encoding)

"base64" encoded text "test", but "base64" extension in wrong position

Result for this UA:

Test Case Generation

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

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

saxon9 datauri.xml datauri.xslt > index.html