[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 18:25:32 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit b4be94a95f07af44b023e472860e40a5cc96bcc1
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Dec 10 19:50:38 2010 +0000

    2010-12-09  Jenn Braithwaite  <jennb at chromium.org>
    
            Reviewed by Adam Barth.
    
            TextResourceDecoder::checkForHeadCharset can look way past the limit.
            https://bugs.webkit.org/show_bug.cgi?id=47397
    
            Replaced charset detection algorithm with real parser.
            Added tests for parser bugs mentioned in the thread for this bug report.
            Converted hixie's encoding parsing tests to a layout test.
    
            Tests: fast/encoding/bracket-in-script.html
                   fast/encoding/bracket-in-tag.html
                   fast/encoding/escaped-bracket.html
                   fast/encoding/meta-in-body.html
                   fast/encoding/meta-in-script.html
                   fast/encoding/meta-in-title.html
                   fast/encoding/mismatched-end-tag.html
                   fast/encoding/namespace-meta.html
                   fast/encoding/not-http-equiv-content.html
                   fast/encoding/parser-tests.html
                   fast/encoding/quotes-in-title.html
                   fast/encoding/tag-name-digit.html
                   http/tests/misc/charset-sniffer-end-sniffing.html
    
            * Android.mk:
            * CMakeLists.txt:
            * GNUmakefile.am:
            * WebCore.gypi:
            * WebCore.pro:
            * WebCore.vcproj/WebCore.vcproj:
            * WebCore.xcodeproj/project.pbxproj:
            * html/parser/HTMLMetaCharsetParser.cpp: Added.
            (WebCore::HTMLMetaCharsetParser::HTMLMetaCharsetParser):
            (WebCore::HTMLMetaCharsetParser::~HTMLMetaCharsetParser):
            (WebCore::HTMLMetaCharsetParser::extractCharset):
            (WebCore::HTMLMetaCharsetParser::processMeta):
            (WebCore::HTMLMetaCharsetParser::checkForMetaCharset):
            * html/parser/HTMLMetaCharsetParser.h: Added.
            (WebCore::HTMLMetaCharsetParser::create):
            (WebCore::HTMLMetaCharsetParser::encoding):
            * loader/TextResourceDecoder.cpp:
            (WebCore::TextResourceDecoder::checkForHeadCharset):
            (WebCore::TextResourceDecoder::checkForMetaCharset):
            * loader/TextResourceDecoder.h:
    2010-12-09  Jenn Braithwaite  <jennb at chromium.org>
    
            Reviewed by Adam Barth.
    
            TextResourceDecoder::checkForHeadCharset can look way past the limit.
            https://bugs.webkit.org/show_bug.cgi?id=47397
    
            Replaced charset detection algorithm with real parser.
            Added tests for parser bugs mentioned in the thread for this bug report.
            Converted hixie's encoding parsing tests to a layout test.
            Added http-equiv attribute to meta tag in 2 existing tests.
    
            * fast/encoding/bracket-in-script-expected.txt: Added.
            * fast/encoding/bracket-in-script.html: Added.
            * fast/encoding/bracket-in-tag-expected.txt: Added.
            * fast/encoding/bracket-in-tag.html: Added.
            * fast/encoding/escaped-bracket-expected.txt: Added.
            * fast/encoding/escaped-bracket.html: Added.
            * fast/encoding/meta-in-body-expected.txt: Added.
            * fast/encoding/meta-in-body.html: Added.
            * fast/encoding/meta-in-script-expected.txt: Added.
            * fast/encoding/meta-in-script.html: Added.
            * fast/encoding/meta-in-title-expected.txt: Added.
            * fast/encoding/meta-in-title.html: Added.
            * fast/encoding/mismatched-end-tag-expected.txt: Added.
            * fast/encoding/mismatched-end-tag.html: Added.
            * fast/encoding/namespace-meta-expected.txt: Added.
            * fast/encoding/namespace-meta.html: Added.
            * fast/encoding/namespace-tolerance.html:
            * fast/encoding/not-http-equiv-content-expected.txt: Added.
            * fast/encoding/not-http-equiv-content.html: Added.
            * fast/encoding/parser-tests-expected.txt: Added.
            * fast/encoding/parser-tests.html: Added.
            * fast/encoding/quotes-in-title-expected.txt: Added.
            * fast/encoding/quotes-in-title.html: Added.
            * fast/encoding/resources/001.html: Added.
            * fast/encoding/resources/002.html: Added.
            * fast/encoding/resources/003.html: Added.
            * fast/encoding/resources/004.html: Added.
            * fast/encoding/resources/005.html: Added.
            * fast/encoding/resources/006.html: Added.
            * fast/encoding/resources/007.html: Added.
            * fast/encoding/resources/008.html: Added.
            * fast/encoding/resources/009.html: Added.
            * fast/encoding/resources/010.html: Added.
            * fast/encoding/resources/011.html: Added.
            * fast/encoding/resources/012.html: Added.
            * fast/encoding/resources/013.html: Added.
            * fast/encoding/resources/014.html: Added.
            * fast/encoding/resources/015.html: Added.
            * fast/encoding/resources/016.html: Added.
            * fast/encoding/resources/017.html: Added.
            * fast/encoding/resources/018.html: Added.
            * fast/encoding/resources/019.html: Added.
            * fast/encoding/resources/020.html: Added.
            * fast/encoding/resources/021.html: Added.
            * fast/encoding/resources/022.html: Added.
            * fast/encoding/resources/023.html: Added.
            * fast/encoding/resources/024.html: Added.
            * fast/encoding/resources/025.html: Added.
            * fast/encoding/resources/026.html: Added.
            * fast/encoding/resources/027.html: Added.
            * fast/encoding/resources/028.html: Added.
            * fast/encoding/resources/029.html: Added.
            * fast/encoding/resources/030.html: Added.
            * fast/encoding/resources/031.html: Added.
            * fast/encoding/resources/032.html: Added.
            * fast/encoding/resources/033.html: Added.
            * fast/encoding/resources/034.html: Added.
            * fast/encoding/resources/035.html: Added.
            * fast/encoding/resources/036.html: Added.
            * fast/encoding/resources/037.html: Added.
            * fast/encoding/resources/038.html: Added.
            * fast/encoding/resources/039.html: Added.
            * fast/encoding/resources/040.html: Added.
            * fast/encoding/resources/041.html: Added.
            * fast/encoding/resources/042.html: Added.
            * fast/encoding/resources/043.html: Added.
            * fast/encoding/resources/044.html: Added.
            * fast/encoding/resources/045.html: Added.
            * fast/encoding/resources/046.html: Added.
            * fast/encoding/resources/047.html: Added.
            * fast/encoding/resources/048.html: Added.
            * fast/encoding/resources/049.html: Added.
            * fast/encoding/resources/050.html: Added.
            * fast/encoding/resources/051.html: Added.
            * fast/encoding/resources/052.html: Added.
            * fast/encoding/resources/053.html: Added.
            * fast/encoding/resources/054.html: Added.
            * fast/encoding/resources/055.html: Added.
            * fast/encoding/resources/056.html: Added.
            * fast/encoding/resources/057.html: Added.
            * fast/encoding/resources/058.html: Added.
            * fast/encoding/resources/059.html: Added.
            * fast/encoding/resources/060.html: Added.
            * fast/encoding/resources/061.html: Added.
            * fast/encoding/resources/062.html: Added.
            * fast/encoding/resources/063.html: Added.
            * fast/encoding/resources/064.html: Added.
            * fast/encoding/resources/065.html: Added.
            * fast/encoding/resources/066.html: Added.
            * fast/encoding/resources/067.html: Added.
            * fast/encoding/resources/068.html: Added.
            * fast/encoding/resources/069.html: Added.
            * fast/encoding/resources/070.html: Added.
            * fast/encoding/resources/071.html: Added.
            * fast/encoding/resources/072.html: Added.
            * fast/encoding/resources/073.html: Added.
            * fast/encoding/resources/074.html: Added.
            * fast/encoding/resources/075.html: Added.
            * fast/encoding/resources/076.html: Added.
            * fast/encoding/resources/077.html: Added.
            * fast/encoding/resources/078.html: Added.
            * fast/encoding/resources/079.html: Added.
            * fast/encoding/resources/080.html: Added.
            * fast/encoding/resources/081.html: Added.
            * fast/encoding/resources/082.html: Added.
            * fast/encoding/resources/083.html: Added.
            * fast/encoding/resources/084.html: Added.
            * fast/encoding/resources/085.html: Added.
            * fast/encoding/resources/086.html: Added.
            * fast/encoding/resources/087.html: Added.
            * fast/encoding/resources/088.html: Added.
            * fast/encoding/resources/089.html: Added.
            * fast/encoding/resources/090.html: Added.
            * fast/encoding/resources/091.html: Added.
            * fast/encoding/resources/092.html: Added.
            * fast/encoding/resources/093.html: Added.
            * fast/encoding/resources/094.html: Added.
            * fast/encoding/resources/095.html: Added.
            * fast/encoding/resources/096.html: Added.
            * fast/encoding/resources/097.html: Added.
            * fast/encoding/resources/098.html: Added.
            * fast/encoding/resources/099.html: Added.
            * fast/encoding/resources/100.html: Added.
            * fast/encoding/resources/101.html: Added.
            * fast/encoding/resources/102.html: Added.
            * fast/encoding/resources/103.html: Added.
            * fast/encoding/resources/104.html: Added.
            * fast/encoding/resources/105.html: Added.
            * fast/encoding/resources/106.html: Added.
            * fast/encoding/resources/107.html: Added.
            * fast/encoding/resources/108.html: Added.
            * fast/encoding/resources/109.html: Added.
            * fast/encoding/resources/110.html: Added.
            * fast/encoding/resources/111.html: Added.
            * fast/encoding/resources/112.html: Added.
            * fast/encoding/resources/113.html: Added.
            * fast/encoding/resources/114.html: Added.
            * fast/encoding/resources/115.html: Added.
            * fast/encoding/resources/116.html: Added.
            * fast/encoding/resources/117.html: Added.
            * fast/encoding/resources/118.html: Added.
            * fast/encoding/resources/119.html: Added.
            * fast/encoding/resources/120.html: Added.
            * fast/encoding/resources/121.html: Added.
            * fast/encoding/resources/122.html: Added.
            * fast/encoding/resources/123.html: Added.
            * fast/encoding/tag-name-digit-expected.txt: Added.
            * fast/encoding/tag-name-digit.html: Added.
            * fast/text/international/bidi-innertext.html:
            * http/tests/misc/charset-sniffer-end-sniffing-expected.txt: Added.
            * http/tests/misc/charset-sniffer-end-sniffing.html: Added.
            * http/tests/misc/resources/charset-sniffer-end-sniffing.php: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73756 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index cf52c14..12248e5 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,168 @@
+2010-12-09  Jenn Braithwaite  <jennb at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        TextResourceDecoder::checkForHeadCharset can look way past the limit.
+        https://bugs.webkit.org/show_bug.cgi?id=47397
+
+        Replaced charset detection algorithm with real parser.
+        Added tests for parser bugs mentioned in the thread for this bug report.
+        Converted hixie's encoding parsing tests to a layout test.
+        Added http-equiv attribute to meta tag in 2 existing tests.
+
+        * fast/encoding/bracket-in-script-expected.txt: Added.
+        * fast/encoding/bracket-in-script.html: Added.
+        * fast/encoding/bracket-in-tag-expected.txt: Added.
+        * fast/encoding/bracket-in-tag.html: Added.
+        * fast/encoding/escaped-bracket-expected.txt: Added.
+        * fast/encoding/escaped-bracket.html: Added.
+        * fast/encoding/meta-in-body-expected.txt: Added.
+        * fast/encoding/meta-in-body.html: Added.
+        * fast/encoding/meta-in-script-expected.txt: Added.
+        * fast/encoding/meta-in-script.html: Added.
+        * fast/encoding/meta-in-title-expected.txt: Added.
+        * fast/encoding/meta-in-title.html: Added.
+        * fast/encoding/mismatched-end-tag-expected.txt: Added.
+        * fast/encoding/mismatched-end-tag.html: Added.
+        * fast/encoding/namespace-meta-expected.txt: Added.
+        * fast/encoding/namespace-meta.html: Added.
+        * fast/encoding/namespace-tolerance.html:
+        * fast/encoding/not-http-equiv-content-expected.txt: Added.
+        * fast/encoding/not-http-equiv-content.html: Added.
+        * fast/encoding/parser-tests-expected.txt: Added.
+        * fast/encoding/parser-tests.html: Added.
+        * fast/encoding/quotes-in-title-expected.txt: Added.
+        * fast/encoding/quotes-in-title.html: Added.
+        * fast/encoding/resources/001.html: Added.
+        * fast/encoding/resources/002.html: Added.
+        * fast/encoding/resources/003.html: Added.
+        * fast/encoding/resources/004.html: Added.
+        * fast/encoding/resources/005.html: Added.
+        * fast/encoding/resources/006.html: Added.
+        * fast/encoding/resources/007.html: Added.
+        * fast/encoding/resources/008.html: Added.
+        * fast/encoding/resources/009.html: Added.
+        * fast/encoding/resources/010.html: Added.
+        * fast/encoding/resources/011.html: Added.
+        * fast/encoding/resources/012.html: Added.
+        * fast/encoding/resources/013.html: Added.
+        * fast/encoding/resources/014.html: Added.
+        * fast/encoding/resources/015.html: Added.
+        * fast/encoding/resources/016.html: Added.
+        * fast/encoding/resources/017.html: Added.
+        * fast/encoding/resources/018.html: Added.
+        * fast/encoding/resources/019.html: Added.
+        * fast/encoding/resources/020.html: Added.
+        * fast/encoding/resources/021.html: Added.
+        * fast/encoding/resources/022.html: Added.
+        * fast/encoding/resources/023.html: Added.
+        * fast/encoding/resources/024.html: Added.
+        * fast/encoding/resources/025.html: Added.
+        * fast/encoding/resources/026.html: Added.
+        * fast/encoding/resources/027.html: Added.
+        * fast/encoding/resources/028.html: Added.
+        * fast/encoding/resources/029.html: Added.
+        * fast/encoding/resources/030.html: Added.
+        * fast/encoding/resources/031.html: Added.
+        * fast/encoding/resources/032.html: Added.
+        * fast/encoding/resources/033.html: Added.
+        * fast/encoding/resources/034.html: Added.
+        * fast/encoding/resources/035.html: Added.
+        * fast/encoding/resources/036.html: Added.
+        * fast/encoding/resources/037.html: Added.
+        * fast/encoding/resources/038.html: Added.
+        * fast/encoding/resources/039.html: Added.
+        * fast/encoding/resources/040.html: Added.
+        * fast/encoding/resources/041.html: Added.
+        * fast/encoding/resources/042.html: Added.
+        * fast/encoding/resources/043.html: Added.
+        * fast/encoding/resources/044.html: Added.
+        * fast/encoding/resources/045.html: Added.
+        * fast/encoding/resources/046.html: Added.
+        * fast/encoding/resources/047.html: Added.
+        * fast/encoding/resources/048.html: Added.
+        * fast/encoding/resources/049.html: Added.
+        * fast/encoding/resources/050.html: Added.
+        * fast/encoding/resources/051.html: Added.
+        * fast/encoding/resources/052.html: Added.
+        * fast/encoding/resources/053.html: Added.
+        * fast/encoding/resources/054.html: Added.
+        * fast/encoding/resources/055.html: Added.
+        * fast/encoding/resources/056.html: Added.
+        * fast/encoding/resources/057.html: Added.
+        * fast/encoding/resources/058.html: Added.
+        * fast/encoding/resources/059.html: Added.
+        * fast/encoding/resources/060.html: Added.
+        * fast/encoding/resources/061.html: Added.
+        * fast/encoding/resources/062.html: Added.
+        * fast/encoding/resources/063.html: Added.
+        * fast/encoding/resources/064.html: Added.
+        * fast/encoding/resources/065.html: Added.
+        * fast/encoding/resources/066.html: Added.
+        * fast/encoding/resources/067.html: Added.
+        * fast/encoding/resources/068.html: Added.
+        * fast/encoding/resources/069.html: Added.
+        * fast/encoding/resources/070.html: Added.
+        * fast/encoding/resources/071.html: Added.
+        * fast/encoding/resources/072.html: Added.
+        * fast/encoding/resources/073.html: Added.
+        * fast/encoding/resources/074.html: Added.
+        * fast/encoding/resources/075.html: Added.
+        * fast/encoding/resources/076.html: Added.
+        * fast/encoding/resources/077.html: Added.
+        * fast/encoding/resources/078.html: Added.
+        * fast/encoding/resources/079.html: Added.
+        * fast/encoding/resources/080.html: Added.
+        * fast/encoding/resources/081.html: Added.
+        * fast/encoding/resources/082.html: Added.
+        * fast/encoding/resources/083.html: Added.
+        * fast/encoding/resources/084.html: Added.
+        * fast/encoding/resources/085.html: Added.
+        * fast/encoding/resources/086.html: Added.
+        * fast/encoding/resources/087.html: Added.
+        * fast/encoding/resources/088.html: Added.
+        * fast/encoding/resources/089.html: Added.
+        * fast/encoding/resources/090.html: Added.
+        * fast/encoding/resources/091.html: Added.
+        * fast/encoding/resources/092.html: Added.
+        * fast/encoding/resources/093.html: Added.
+        * fast/encoding/resources/094.html: Added.
+        * fast/encoding/resources/095.html: Added.
+        * fast/encoding/resources/096.html: Added.
+        * fast/encoding/resources/097.html: Added.
+        * fast/encoding/resources/098.html: Added.
+        * fast/encoding/resources/099.html: Added.
+        * fast/encoding/resources/100.html: Added.
+        * fast/encoding/resources/101.html: Added.
+        * fast/encoding/resources/102.html: Added.
+        * fast/encoding/resources/103.html: Added.
+        * fast/encoding/resources/104.html: Added.
+        * fast/encoding/resources/105.html: Added.
+        * fast/encoding/resources/106.html: Added.
+        * fast/encoding/resources/107.html: Added.
+        * fast/encoding/resources/108.html: Added.
+        * fast/encoding/resources/109.html: Added.
+        * fast/encoding/resources/110.html: Added.
+        * fast/encoding/resources/111.html: Added.
+        * fast/encoding/resources/112.html: Added.
+        * fast/encoding/resources/113.html: Added.
+        * fast/encoding/resources/114.html: Added.
+        * fast/encoding/resources/115.html: Added.
+        * fast/encoding/resources/116.html: Added.
+        * fast/encoding/resources/117.html: Added.
+        * fast/encoding/resources/118.html: Added.
+        * fast/encoding/resources/119.html: Added.
+        * fast/encoding/resources/120.html: Added.
+        * fast/encoding/resources/121.html: Added.
+        * fast/encoding/resources/122.html: Added.
+        * fast/encoding/resources/123.html: Added.
+        * fast/encoding/tag-name-digit-expected.txt: Added.
+        * fast/encoding/tag-name-digit.html: Added.
+        * fast/text/international/bidi-innertext.html:
+        * http/tests/misc/charset-sniffer-end-sniffing-expected.txt: Added.
+        * http/tests/misc/charset-sniffer-end-sniffing.html: Added.
+        * http/tests/misc/resources/charset-sniffer-end-sniffing.php: Added.
+
 2010-12-10  Mihai Parparita  <mihaip at chromium.org>
 
         Unreviewed Chromium test expectation update.
diff --git a/LayoutTests/fast/encoding/bracket-in-script-expected.txt b/LayoutTests/fast/encoding/bracket-in-script-expected.txt
new file mode 100644
index 0000000..d5da37d
--- /dev/null
+++ b/LayoutTests/fast/encoding/bracket-in-script-expected.txt
@@ -0,0 +1,4 @@
+PASS: windows-1255
+This test checks that charset sniffer does not get confused by the left angle bracket that is not part of a tag. There was a bug where the less-than caused all text after it until the next closing bracket to be consumed as the tag, resulting in the closing script tag being missed by the charset sniffer.
+
+The charset sniffer would think it was still in the script mode and ignore the meta tag. This test relies on the charset sniffer ignoring meta tags inside script and checking at least 1024 bytes of data for a meta tag.
diff --git a/LayoutTests/fast/encoding/bracket-in-script.html b/LayoutTests/fast/encoding/bracket-in-script.html
new file mode 100644
index 0000000..0f923ed
--- /dev/null
+++ b/LayoutTests/fast/encoding/bracket-in-script.html
@@ -0,0 +1,27 @@
+<html>
+<head>
+<script>
+if (2 < 1) foo = bar;
+</script>
+</head>
+<body>
+<meta charset=windows-1255>
+<pre id="log"></pre>
+<script>
+function log(message)
+{
+    document.getElementById("log").innerText += message + "\n";
+}
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+if (document.inputEncoding == "windows-1255")
+    log("PASS: " + document.inputEncoding);
+else
+    log("FAIL: " + document.inputEncoding);
+</script>
+<p>This test checks that charset sniffer does not get confused by the left angle bracket that is not part of a tag. There was a bug where the less-than caused all text after it until the next closing bracket to be consumed as the tag, resulting in the closing script tag being missed by the charset sniffer.</p>
+<p>The charset sniffer would think it was still in the script mode and ignore the meta tag. This test relies on the charset sniffer ignoring meta tags inside script and checking at least 1024 bytes of data for a meta tag.</p>
+</body>
+</html>
diff --git a/LayoutTests/fast/encoding/bracket-in-tag-expected.txt b/LayoutTests/fast/encoding/bracket-in-tag-expected.txt
new file mode 100644
index 0000000..689d1ec
--- /dev/null
+++ b/LayoutTests/fast/encoding/bracket-in-tag-expected.txt
@@ -0,0 +1,2 @@
+ PASS: ISO-8859-1
+This test baselines charset sniffer behavior where the opening bracket inside a tag is consumed as part of the tag data, causing the meta tag to be missed.
diff --git a/LayoutTests/fast/encoding/bracket-in-tag.html b/LayoutTests/fast/encoding/bracket-in-tag.html
new file mode 100644
index 0000000..36862e4
--- /dev/null
+++ b/LayoutTests/fast/encoding/bracket-in-tag.html
@@ -0,0 +1,23 @@
+<html>
+<head>
+<foo<meta charset=windows-1255>
+</head>
+<body>
+<pre id="log"></pre>
+<script>
+function log(message)
+{
+    document.getElementById("log").innerText += message + "\n";
+}
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+if (document.inputEncoding == "windows-1255")
+    log("FAIL: " + document.inputEncoding);
+else
+    log("PASS: " + document.inputEncoding);
+</script>
+<p>This test baselines charset sniffer behavior where the opening bracket inside a tag is consumed as part of the tag data, causing the meta tag to be missed.
+</body>
+</html>
diff --git a/LayoutTests/fast/encoding/escaped-bracket-expected.txt b/LayoutTests/fast/encoding/escaped-bracket-expected.txt
new file mode 100644
index 0000000..faf6564
--- /dev/null
+++ b/LayoutTests/fast/encoding/escaped-bracket-expected.txt
@@ -0,0 +1,2 @@
+PASS: KOI8-R
+This test checks whether charset sniffer skips over escaped characters correctly.
diff --git a/LayoutTests/fast/encoding/escaped-bracket.html b/LayoutTests/fast/encoding/escaped-bracket.html
new file mode 100644
index 0000000..0566d0d
--- /dev/null
+++ b/LayoutTests/fast/encoding/escaped-bracket.html
@@ -0,0 +1,28 @@
+<html>
+<head>
+<title>
+foo="\</title\>"
+<meta charset=windows-1255>
+</title>
+<meta charset=KOI8-R>
+</head>
+<body>
+<pre id="log"></pre>
+<script>
+function log(message)
+{
+    document.getElementById("log").innerText += message + "\n";
+}
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+if (document.inputEncoding == "KOI8-R")
+    log("PASS: " + document.inputEncoding);
+else
+    log("FAIL: " + document.inputEncoding);
+</script>
+<p>
+This test checks whether charset sniffer skips over escaped characters correctly.
+</body>
+</html>
diff --git a/LayoutTests/fast/encoding/meta-in-body-expected.txt b/LayoutTests/fast/encoding/meta-in-body-expected.txt
new file mode 100644
index 0000000..2996f64
--- /dev/null
+++ b/LayoutTests/fast/encoding/meta-in-body-expected.txt
@@ -0,0 +1,2 @@
+PASS: ISO-2022-JP
+This test checks that the charset sniffer scans at least 1024 bytes of data to find a meta tag, even if it is not in the head section.
diff --git a/LayoutTests/fast/encoding/meta-in-body.html b/LayoutTests/fast/encoding/meta-in-body.html
new file mode 100644
index 0000000..f66097c
--- /dev/null
+++ b/LayoutTests/fast/encoding/meta-in-body.html
@@ -0,0 +1,24 @@
+<html>
+<head>
+</head>
+<body>
+<meta charset=ISO-2022-JP>
+<pre id="log"></pre>
+<script>
+function log(message)
+{
+    document.getElementById("log").innerText += message + "\n";
+}
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+if (document.inputEncoding == "ISO-2022-JP")
+    log("PASS: " + document.inputEncoding);
+else
+    log("FAIL: " + document.inputEncoding);
+</script>
+<p>
+This test checks that the charset sniffer scans at least 1024 bytes of data to find a meta tag, even if it is not in the head section.
+</body>
+</html>
diff --git a/LayoutTests/fast/encoding/meta-in-script-expected.txt b/LayoutTests/fast/encoding/meta-in-script-expected.txt
new file mode 100644
index 0000000..ab9fb78
--- /dev/null
+++ b/LayoutTests/fast/encoding/meta-in-script-expected.txt
@@ -0,0 +1,3 @@
+CONSOLE MESSAGE: line 4: SyntaxError: Parse error
+PASS: windows-1255
+This test passes if the charset is parsed from the meta tag outside the script.
diff --git a/LayoutTests/fast/encoding/meta-in-script.html b/LayoutTests/fast/encoding/meta-in-script.html
new file mode 100644
index 0000000..523788f
--- /dev/null
+++ b/LayoutTests/fast/encoding/meta-in-script.html
@@ -0,0 +1,26 @@
+<html>
+<head>
+<script>
+<meta charset=koi8-r>
+</script>
+<meta charset=windows-1255>
+</head>
+<body>
+<pre id="log"></pre>
+<script>
+function log(message)
+{
+    document.getElementById("log").innerText += message + "\n";
+}
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+if (document.inputEncoding == "windows-1255")
+    log("PASS: " + document.inputEncoding);
+else
+    log("FAIL: " + document.inputEncoding);
+</script>
+<p>This test passes if the charset is parsed from the meta tag outside the script.
+</body>
+</html>
diff --git a/LayoutTests/fast/encoding/meta-in-title-expected.txt b/LayoutTests/fast/encoding/meta-in-title-expected.txt
new file mode 100644
index 0000000..5322e7b
--- /dev/null
+++ b/LayoutTests/fast/encoding/meta-in-title-expected.txt
@@ -0,0 +1,2 @@
+PASS: KOI8-R
+This test verifies that charset sniffer ignores meta tag in a title.
diff --git a/LayoutTests/fast/encoding/meta-in-title.html b/LayoutTests/fast/encoding/meta-in-title.html
new file mode 100644
index 0000000..ce07e51
--- /dev/null
+++ b/LayoutTests/fast/encoding/meta-in-title.html
@@ -0,0 +1,27 @@
+<html>
+<head>
+<title>
+<meta charset=windows-1255>
+</title>
+<meta charset=KOI8-R>
+</head>
+<body>
+<pre id="log"></pre>
+<script>
+function log(message)
+{
+    document.getElementById("log").innerText += message + "\n";
+}
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+if (document.inputEncoding == "KOI8-R")
+    log("PASS: " + document.inputEncoding);
+else
+    log("FAIL: " + document.inputEncoding);
+</script>
+<p>
+This test verifies that charset sniffer ignores meta tag in a title.
+</body>
+</html>
diff --git a/LayoutTests/fast/encoding/mismatched-end-tag-expected.txt b/LayoutTests/fast/encoding/mismatched-end-tag-expected.txt
new file mode 100644
index 0000000..760606b
--- /dev/null
+++ b/LayoutTests/fast/encoding/mismatched-end-tag-expected.txt
@@ -0,0 +1,2 @@
+PASS: windows-1255
+This test checks that charset sniffer does not get confused by the extraneous end script tag and ignore the meta tag, thinking it is inside a script.
diff --git a/LayoutTests/fast/encoding/mismatched-end-tag.html b/LayoutTests/fast/encoding/mismatched-end-tag.html
new file mode 100644
index 0000000..2b738c4
--- /dev/null
+++ b/LayoutTests/fast/encoding/mismatched-end-tag.html
@@ -0,0 +1,24 @@
+<html>
+<head>
+</script>
+<meta charset=windows-1255>
+</head>
+<body>
+<pre id="log"></pre>
+<script>
+function log(message)
+{
+    document.getElementById("log").innerText += message + "\n";
+}
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+if (document.inputEncoding == "windows-1255")
+    log("PASS: " + document.inputEncoding);
+else
+    log("FAIL: " + document.inputEncoding);
+</script>
+<p>This test checks that charset sniffer does not get confused by the extraneous end script tag and ignore the meta tag, thinking it is inside a script.</p>
+</body>
+</html>
diff --git a/LayoutTests/fast/encoding/namespace-meta-expected.txt b/LayoutTests/fast/encoding/namespace-meta-expected.txt
new file mode 100644
index 0000000..23b9916
--- /dev/null
+++ b/LayoutTests/fast/encoding/namespace-meta-expected.txt
@@ -0,0 +1,3 @@
+This test checks that the charset sniffer ignores namespaced meta tags.
+PASS: ISO-2022-JP
+
diff --git a/LayoutTests/fast/encoding/namespace-meta.html b/LayoutTests/fast/encoding/namespace-meta.html
new file mode 100644
index 0000000..e994438
--- /dev/null
+++ b/LayoutTests/fast/encoding/namespace-meta.html
@@ -0,0 +1,24 @@
+<html>
+<head>
+<testme:meta charset=windows-1252>
+<meta charset=ISO-2022-JP>
+</head>
+<body>
+This test checks that the charset sniffer ignores namespaced meta tags.
+<pre id="log"></pre>
+<script>
+function log(message)
+{
+    document.getElementById("log").innerText += message + "\n";
+}
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+if (document.inputEncoding == "ISO-2022-JP")
+    log("PASS: " + document.inputEncoding);
+else
+    log("FAIL: " + document.inputEncoding);
+</script>
+</body>
+</html>
diff --git a/LayoutTests/fast/encoding/namespace-tolerance.html b/LayoutTests/fast/encoding/namespace-tolerance.html
index c7841d2..7c3692d 100644
--- a/LayoutTests/fast/encoding/namespace-tolerance.html
+++ b/LayoutTests/fast/encoding/namespace-tolerance.html
@@ -1,5 +1,5 @@
 <xhtml:html xmlns:xhtml="">
-<meta content="charset=UTF-8">
+<meta content="charset=UTF-8" http-equiv="Content-Type">
 
 This test ensures a UTF-8 encoding is properly set on documents that:
 <br>
diff --git a/LayoutTests/fast/encoding/not-http-equiv-content-expected.txt b/LayoutTests/fast/encoding/not-http-equiv-content-expected.txt
new file mode 100644
index 0000000..7740144
--- /dev/null
+++ b/LayoutTests/fast/encoding/not-http-equiv-content-expected.txt
@@ -0,0 +1,2 @@
+PASS: windows-1255
+This test checks that charset sniffer does not get confused by the text that contains charset wording.
diff --git a/LayoutTests/fast/encoding/not-http-equiv-content.html b/LayoutTests/fast/encoding/not-http-equiv-content.html
new file mode 100644
index 0000000..dcc1476
--- /dev/null
+++ b/LayoutTests/fast/encoding/not-http-equiv-content.html
@@ -0,0 +1,24 @@
+<html>
+<head>
+<meta name="description" content="how to set charset=utf-8 on HTML docs">
+<meta http-equiv="content-type" content="text/html; charset=windows-1255">
+</head>
+<body>
+<pre id="log"></pre>
+<script>
+function log(message)
+{
+    document.getElementById("log").innerText += message + "\n";
+}
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+if (document.inputEncoding == "windows-1255")
+    log("PASS: " + document.inputEncoding);
+else
+    log("FAIL: " + document.inputEncoding);
+</script>
+<p>This test checks that charset sniffer does not get confused by the text that contains charset wording.</p>
+</body>
+</html>
diff --git a/LayoutTests/fast/encoding/parser-tests-expected.txt b/LayoutTests/fast/encoding/parser-tests-expected.txt
new file mode 100644
index 0000000..fb15ae2
--- /dev/null
+++ b/LayoutTests/fast/encoding/parser-tests-expected.txt
@@ -0,0 +1,39 @@
+This test suite was converted from http://www.hixie.ch/tests/adhoc/html/parsing/encoding/all.html
+
+Expected failures:
+56, 57, 58, 59 - we do not run scripts during encoding detection phase and parser treats meta inside a script as text, not a tag.
+60 - parser treats meta inside style as text, not a tag.
+97, 99, 102 - we do not run scripts during encoding detection.
+Status: Tests ran.
+
+Serious failures:
+
+test 056: expected Windows-1254; used Windows-1252
+<!DOCTYPE HTML>
+<script>document.write('<meta charset="ISO-8859-' + '9">')</script>
+test 057: expected Windows-1254; used Windows-1252
+<!DOCTYPE HTML>
+<script>var s = '9">'; document.write('<meta charset="ISO-8859-' + s)</script>
+test 058: expected Windows-1254; used Windows-1252
+<!DOCTYPE HTML>
+<script>document.write('<meta charset="ISO-8859-9">')</script>
+test 059: expected Windows-1254; used Windows-1252
+<!DOCTYPE HTML>
+<script type="text/plain"><meta charset="ISO-8859-9"></script>
+test 060: expected Windows-1254; used Windows-1252
+<!DOCTYPE HTML>
+<style type="text/plain"><meta charset="ISO-8859-9"></style>
+test 097: expected Windows-1254; used Windows-1252
+<!DOCTYPE HTML>
+<script>document.write(atob('PG1ldGEgaHR0cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7Y2hhcnNldD1JU08tODg1OS05Ij4='))</script>
+test 099: expected Windows-1252; used Windows-1254
+<!DOCTYPE HTML>
+<script>document.write(atob('PG1ldGEgaHR0cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7Y2hhcnNldD1JU08tODg1OS0xIj4='))</script>
+<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-9">
+test 102: expected Windows-1254; used Windows-1252
+<!DOCTYPE HTML>
+<script>document.write(atob('PG1ldGEgaHR0cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7Y2hhcnNldD1JU08tODg1OS05Ij4='))</script>
+<script>document.write(atob('PG1ldGEgaHR0cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7Y2hhcnNldD1JU08tODg1OS0xIj4='))</script>
+(Tests are considered to pass even if they treat Win1254 and ISO-8859-4 as separate.)
+
+
diff --git a/LayoutTests/fast/encoding/parser-tests.html b/LayoutTests/fast/encoding/parser-tests.html
new file mode 100644
index 0000000..fead50a
--- /dev/null
+++ b/LayoutTests/fast/encoding/parser-tests.html
@@ -0,0 +1,67 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+  <title>Harness</title>
+ </head>
+ <body onload="runtests()">
+  <p>This test suite was converted from http://www.hixie.ch/tests/adhoc/html/parsing/encoding/all.html</p>
+  <ul>Expected failures:
+    <li>56, 57, 58, 59 - we do not run scripts during encoding detection phase and parser treats meta inside a script as text, not a tag.</li>
+    <li>60 - parser treats meta inside style as text, not a tag.</li>
+    <li>97, 99, 102 - we do not run scripts during encoding detection.</li>
+  </ul>
+  <p>Status: <span id="status">Tests did not run.</span></p>
+  <p>Serious failures:</p>
+  <ol id="failures">
+  </ol>
+  <p>(Tests are considered to pass even if they treat Win1254 and ISO-8859-4 as separate.)</p>
+  <p><iframe id="test"></iframe></p>
+  <script>
+   if (window.layoutTestController) {
+       layoutTestController.dumpAsText();
+       layoutTestController.waitUntilDone();
+   }
+
+   var frame = document.getElementById('test');
+   var current = 1;
+   var max = 123;
+   function dotest() {
+     var s = current + '';
+     while (s.length < 3) s = '0' + s;
+     frame.src = 'resources/' + s + '.html';
+     window.receivedResults = function () {
+       var want = frame.contentWindow.document.getElementById('expected').firstChild.data;
+       var have = frame.contentWindow.document.getElementById('encoding').firstChild.data;
+       if (have == 'ISO-8859-9')
+         have = 'Windows-1254';
+       if (want != have) {
+         var li = document.createElement('li');
+         var a = document.createElement('a');
+         a.appendChild(document.createTextNode('test ' + s));
+         a.href = s + '.html';
+         li.appendChild(a);
+         li.appendChild(document.createTextNode(': expected ' + want + '; used ' + have));
+         var pre = document.createElement('pre');
+         pre.appendChild(document.createTextNode(frame.contentWindow.document.getElementsByTagName('pre')[0].firstChild.data));
+         li.appendChild(pre);
+         li.value = current;
+         document.getElementById('failures').appendChild(li);
+       }
+       current += 1;
+       if (current <= max)
+         dotest();
+       else {
+         frame.parentNode.removeChild(frame);
+         document.getElementById('status').innerText = "Tests ran.";
+         if (window.layoutTestController)
+             layoutTestController.notifyDone();
+       }
+     };
+   }
+   function runtests() {
+     dotest();
+   }
+   function alert() { }
+  </script>
+ </body>
+</html>
diff --git a/LayoutTests/fast/encoding/quotes-in-title-expected.txt b/LayoutTests/fast/encoding/quotes-in-title-expected.txt
new file mode 100644
index 0000000..c430b7f
--- /dev/null
+++ b/LayoutTests/fast/encoding/quotes-in-title-expected.txt
@@ -0,0 +1,2 @@
+PASS: KOI8-R
+This test checks whether charset sniffer skips over quoted elements in a title tag correctly. Tests a bug in the charset sniffer that would consume all characters after the bracket in the quoted text until the next closing bracket, causing the closing title tag to be missed.
diff --git a/LayoutTests/fast/encoding/quotes-in-title.html b/LayoutTests/fast/encoding/quotes-in-title.html
new file mode 100644
index 0000000..117525b
--- /dev/null
+++ b/LayoutTests/fast/encoding/quotes-in-title.html
@@ -0,0 +1,27 @@
+<html>
+<head>
+<title>
+foo="<a"
+</title>
+<meta charset=KOI8-R>
+</head>
+<body>
+<pre id="log"></pre>
+<script>
+function log(message)
+{
+    document.getElementById("log").innerText += message + "\n";
+}
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+if (document.inputEncoding == "KOI8-R")
+    log("PASS: " + document.inputEncoding);
+else
+    log("FAIL: " + document.inputEncoding);
+</script>
+<p>
+This test checks whether charset sniffer skips over quoted elements in a title tag correctly. Tests a bug in the charset sniffer that would consume all characters after the bracket in the quoted text until the next closing bracket, causing the closing title tag to be missed.
+</body>
+</html>
diff --git a/LayoutTests/fast/encoding/resources/001.html b/LayoutTests/fast/encoding/resources/001.html
new file mode 100644
index 0000000..cbd5646
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/001.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<!-- (control test - for the other tests to work, this should pass - you may have to set your defaults appropriately) -->
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;!-- (control test - for the other tests to work, this should pass - you may have to set your defaults appropriately) --></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/002.html b/LayoutTests/fast/encoding/resources/002.html
new file mode 100644
index 0000000..ae24214
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/002.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta charset="ISO-8859-1">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta charset="ISO-8859-1"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/003.html b/LayoutTests/fast/encoding/resources/003.html
new file mode 100644
index 0000000..83b47eb
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/003.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta charset="ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta charset="ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/004.html b/LayoutTests/fast/encoding/resources/004.html
new file mode 100644
index 0000000..28c00c9
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/004.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta charset='ISO-8859-9'>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta charset='ISO-8859-9'></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/005.html b/LayoutTests/fast/encoding/resources/005.html
new file mode 100644
index 0000000..af4e682
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/005.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta charset=ISO-8859-9>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta charset=ISO-8859-9></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/006.html b/LayoutTests/fast/encoding/resources/006.html
new file mode 100644
index 0000000..92ac336
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/006.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<meta
+charset=ISO-8859-9>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta
+charset=ISO-8859-9></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/007.html b/LayoutTests/fast/encoding/resources/007.html
new file mode 100644
index 0000000..92e7130
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/007.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<metacharset=ISO-8859-9>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;metacharset=ISO-8859-9></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/008.html b/LayoutTests/fast/encoding/resources/008.html
new file mode 100644
index 0000000..076a3c9
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/008.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/009.html b/LayoutTests/fast/encoding/resources/009.html
new file mode 100644
index 0000000..482e33d
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/009.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta content="text/html; charset=ISO-8859-9" http-equiv="Content-Type">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta content="text/html; charset=ISO-8859-9" http-equiv="Content-Type"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/010.html b/LayoutTests/fast/encoding/resources/010.html
new file mode 100644
index 0000000..ce0b0ee
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/010.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content=text/html; charset=ISO-8859-9>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content=text/html; charset=ISO-8859-9></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/011.html b/LayoutTests/fast/encoding/resources/011.html
new file mode 100644
index 0000000..46aea57
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/011.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type content="text/html; charset=ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type content="text/html; charset=ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/012.html b/LayoutTests/fast/encoding/resources/012.html
new file mode 100644
index 0000000..49fbac1
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/012.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type " content="text/html; charset=ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type " content="text/html; charset=ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/013.html b/LayoutTests/fast/encoding/resources/013.html
new file mode 100644
index 0000000..39cc3ed
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/013.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta content="text/html; charset=ISO-8859-9" http-equiv="Content-Type ">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta content="text/html; charset=ISO-8859-9" http-equiv="Content-Type "></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/014.html b/LayoutTests/fast/encoding/resources/014.html
new file mode 100644
index 0000000..26954c1
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/014.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type>" content="text/html; charset=ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type>" content="text/html; charset=ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/015.html b/LayoutTests/fast/encoding/resources/015.html
new file mode 100644
index 0000000..17d3222
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/015.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta content="text/html; charset=ISO-8859-9" http-equiv="Content-Type>">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta content="text/html; charset=ISO-8859-9" http-equiv="Content-Type>"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/016.html b/LayoutTests/fast/encoding/resources/016.html
new file mode 100644
index 0000000..885da5a
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/016.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Style-Type" content="text/html; charset=ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Style-Type" content="text/html; charset=ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/017.html b/LayoutTests/fast/encoding/resources/017.html
new file mode 100644
index 0000000..ac908cb
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/017.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta content="text/html; charset=ISO-8859-9" http-equiv="Content-Style-Type">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta content="text/html; charset=ISO-8859-9" http-equiv="Content-Style-Type"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/018.html b/LayoutTests/fast/encoding/resources/018.html
new file mode 100644
index 0000000..4da5001
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/018.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta name="Content-Style-Type" content="text/html; charset=ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta name="Content-Style-Type" content="text/html; charset=ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/019.html b/LayoutTests/fast/encoding/resources/019.html
new file mode 100644
index 0000000..687d24f
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/019.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta content="text/html; charset=ISO-8859-9" name="Content-Style-Type">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta content="text/html; charset=ISO-8859-9" name="Content-Style-Type"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/020.html b/LayoutTests/fast/encoding/resources/020.html
new file mode 100644
index 0000000..0c3a15b
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/020.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta content="text/html; charset=ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta content="text/html; charset=ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/021.html b/LayoutTests/fast/encoding/resources/021.html
new file mode 100644
index 0000000..4f0bd5a
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/021.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta content=" text/html; charset = ISO-8859-9 ">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta content=" text/html; charset = ISO-8859-9 "></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/022.html b/LayoutTests/fast/encoding/resources/022.html
new file mode 100644
index 0000000..9c7d101
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/022.html
@@ -0,0 +1,70 @@
+<!DOCTYPE HTML>
+<meta content="
+text/html; charset=ISO-8859-9
+">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta content="
+text/html; charset=ISO-8859-9
+"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/023.html b/LayoutTests/fast/encoding/resources/023.html
new file mode 100644
index 0000000..902833f
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/023.html
@@ -0,0 +1,70 @@
+<!DOCTYPE HTML>
+<meta charset="
+ISO-8859-9
+">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta charset="
+ISO-8859-9
+"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/024.html b/LayoutTests/fast/encoding/resources/024.html
new file mode 100644
index 0000000..5c1a2b0
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/024.html
@@ -0,0 +1,70 @@
+<!DOCTYPE HTML>
+<meta charset=
+ISO-8859-9
+>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta charset=
+ISO-8859-9
+></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/025.html b/LayoutTests/fast/encoding/resources/025.html
new file mode 100644
index 0000000..8430d0e
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/025.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<meta charset="ISO-8859-9>
+<p>"</p>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta charset="ISO-8859-9>
+&lt;p>"&lt;/p></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/026.html b/LayoutTests/fast/encoding/resources/026.html
new file mode 100644
index 0000000..590236d
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/026.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<meta charset=ISO-8859-9">
+<p>"</p>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta charset=ISO-8859-9">
+&lt;p>"&lt;/p></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/027.html b/LayoutTests/fast/encoding/resources/027.html
new file mode 100644
index 0000000..9833c1a
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/027.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<meta " charset=ISO-8859-9>
+<p>"</p>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta " charset=ISO-8859-9>
+&lt;p>"&lt;/p></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/028.html b/LayoutTests/fast/encoding/resources/028.html
new file mode 100644
index 0000000..5dac790
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/028.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<meta test" charset=ISO-8859-9>
+<p>"</p>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta test" charset=ISO-8859-9>
+&lt;p>"&lt;/p></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/029.html b/LayoutTests/fast/encoding/resources/029.html
new file mode 100644
index 0000000..e7dd125
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/029.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<meta test=" charset=ISO-8859-9>
+<p>"</p>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta test=" charset=ISO-8859-9>
+&lt;p>"&lt;/p></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/030.html b/LayoutTests/fast/encoding/resources/030.html
new file mode 100644
index 0000000..c747340
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/030.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<meta test="' charset=ISO-8859-9>
+<p>"'</p>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta test="' charset=ISO-8859-9>
+&lt;p>"'&lt;/p></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/031.html b/LayoutTests/fast/encoding/resources/031.html
new file mode 100644
index 0000000..4bebc5f
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/031.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<meta test='" charset=ISO-8859-9>
+<p>'"</p>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta test='" charset=ISO-8859-9>
+&lt;p>'"&lt;/p></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/032.html b/LayoutTests/fast/encoding/resources/032.html
new file mode 100644
index 0000000..2c72136
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/032.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta test="" charset=ISO-8859-9>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta test="" charset=ISO-8859-9></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/033.html b/LayoutTests/fast/encoding/resources/033.html
new file mode 100644
index 0000000..575e259
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/033.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<meta test=x" charset=ISO-8859-9>
+<p>"</p>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta test=x" charset=ISO-8859-9>
+&lt;p>"&lt;/p></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/034.html b/LayoutTests/fast/encoding/resources/034.html
new file mode 100644
index 0000000..7b63622
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/034.html
@@ -0,0 +1,70 @@
+<!DOCTYPE HTML>
+<head></head><p title="x>
+<meta test=x" charset=ISO-8859-9>
+<p>"</p>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;head>&lt;/head>&lt;p title="x>
+&lt;meta test=x" charset=ISO-8859-9>
+&lt;p>"&lt;/p></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/035.html b/LayoutTests/fast/encoding/resources/035.html
new file mode 100644
index 0000000..bf5c398
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/035.html
@@ -0,0 +1,70 @@
+<!DOCTYPE HTML>
+<head></head><p title="x>
+<meta test=x charset=ISO-8859-9>
+<p>"</p>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;head>&lt;/head>&lt;p title="x>
+&lt;meta test=x charset=ISO-8859-9>
+&lt;p>"&lt;/p></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/036.html b/LayoutTests/fast/encoding/resources/036.html
new file mode 100644
index 0000000..c78d361
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/036.html
@@ -0,0 +1,70 @@
+<!DOCTYPE HTML>
+<head></head><p title="x>
+<meta charset=ISO-8859-9>
+<p>"</p>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;head>&lt;/head>&lt;p title="x>
+&lt;meta charset=ISO-8859-9>
+&lt;p>"&lt;/p></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/037.html b/LayoutTests/fast/encoding/resources/037.html
new file mode 100644
index 0000000..a30dc05
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/037.html
@@ -0,0 +1,70 @@
+<!DOCTYPE HTML>
+<head></head><p title="x>">
+<meta charset=ISO-8859-9>
+<p>"</p>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;head>&lt;/head>&lt;p title="x>">
+&lt;meta charset=ISO-8859-9>
+&lt;p>"&lt;/p></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/038.html b/LayoutTests/fast/encoding/resources/038.html
new file mode 100644
index 0000000..6e914d8
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/038.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<meta charset="ISO-8859-1">
+<meta charset="ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta charset="ISO-8859-1">
+&lt;meta charset="ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/039.html b/LayoutTests/fast/encoding/resources/039.html
new file mode 100644
index 0000000..4778b94
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/039.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<meta charset="ISO-8859-9">
+<meta charset="ISO-8859-1">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta charset="ISO-8859-9">
+&lt;meta charset="ISO-8859-1"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/040.html b/LayoutTests/fast/encoding/resources/040.html
new file mode 100644
index 0000000..b34871f
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/040.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<!--<meta charset="ISO-8859-1">-->
+<meta charset="ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;!--&lt;meta charset="ISO-8859-1">-->
+&lt;meta charset="ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/041.html b/LayoutTests/fast/encoding/resources/041.html
new file mode 100644
index 0000000..775987b
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/041.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<!--<meta charset="ISO-8859-9">-->
+<meta charset="ISO-8859-1">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;!--&lt;meta charset="ISO-8859-9">-->
+&lt;meta charset="ISO-8859-1"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/042.html b/LayoutTests/fast/encoding/resources/042.html
new file mode 100644
index 0000000..981da43
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/042.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<!-- Starts with UTF-8 BOM -->
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;!-- Starts with UTF-8 BOM --></pre>
+<p>Expected result: <span id="expected">UTF-8</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/043.html b/LayoutTests/fast/encoding/resources/043.html
new file mode 100644
index 0000000..02d655b
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/043.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<meta charset="ISO-8859-1">
+<!-- Starts with UTF-8 BOM -->
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta charset="ISO-8859-1">
+&lt;!-- Starts with UTF-8 BOM --></pre>
+<p>Expected result: <span id="expected">UTF-8</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/044.html b/LayoutTests/fast/encoding/resources/044.html
new file mode 100644
index 0000000..e459d9b
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/044.html
@@ -0,0 +1,66 @@
+<!-- 511 characters xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
+<meta charset="ISO-8859-9">
+<p>Test:
+<pre>&lt;!-- 511 characters xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
+&lt;meta charset="ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/045.html b/LayoutTests/fast/encoding/resources/045.html
new file mode 100644
index 0000000..b2bdd5a
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/045.html
@@ -0,0 +1,66 @@
+<!-- 512 characters xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
+<meta charset="ISO-8859-9">
+<p>Test:
+<pre>&lt;!-- 512 characters xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
+&lt;meta charset="ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/046.html b/LayoutTests/fast/encoding/resources/046.html
new file mode 100644
index 0000000..96c60ce
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/046.html
@@ -0,0 +1,66 @@
+<!-- 513 characters xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz-->
+<meta charset="ISO-8859-9">
+<p>Test:
+<pre>&lt;!-- 513 characters xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz-->
+&lt;meta charset="ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/047.html b/LayoutTests/fast/encoding/resources/047.html
new file mode 100644
index 0000000..3ff31a7
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/047.html
@@ -0,0 +1,66 @@
+<!-- 1024 characters xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
+&lt;meta charset="ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/048.html b/LayoutTests/fast/encoding/resources/048.html
new file mode 100644
index 0000000..b91a7d4
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/048.html
@@ -0,0 +1,66 @@
+<!-- 1025 characters xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz-->
+&lt;meta charset="ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/049.html b/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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
+&lt;meta charset="ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/050.html b/LayoutTests/fast/encoding/resources/050.html
new file mode 100644
index 0000000..b43973d
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/050.html
@@ -0,0 +1,66 @@
+<!-- 2049 characters xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz-->
+&lt;meta charset="ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/051.html b/LayoutTests/fast/encoding/resources/051.html
new file mode 100644
index 0000000..c50fb37
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/051.html
@@ -0,0 +1,66 @@
+<!-- 4096 characters xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
+&lt;meta charset="ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/052.html b/LayoutTests/fast/encoding/resources/052.html
new file mode 100644
index 0000000..4375a95
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/052.html
@@ -0,0 +1,66 @@
+<!-- 4097 characters xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz-->
+&lt;meta charset="ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/053.html b/LayoutTests/fast/encoding/resources/053.html
new file mode 100644
index 0000000..1eca9c8
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/053.html
@@ -0,0 +1,66 @@
+<!-- 8192 characters xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
+&lt;meta charset="ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/054.html b/LayoutTests/fast/encoding/resources/054.html
new file mode 100644
index 0000000..2e470a2
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/054.html
@@ -0,0 +1,66 @@
+<!-- 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</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/055.html b/LayoutTests/fast/encoding/resources/055.html
new file mode 100644
index 0000000..4e05762
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/055.html
@@ -0,0 +1,74 @@
+<!-- multi-script test -->
+<script>parent.alert('step 1 of 3 ("þ")')</script>
+<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+<script>parent.alert('step 2 of 3 ("þ")')</script>
+<meta charset="ISO-8859-9">
+<script>parent.alert('step 3 of 3 ("þ")')</script>
+<p>Test:
+<pre>&lt;!-- multi-script test -->
+&lt;script>parent.alert('step 1 of 3 ("þ")')&lt;/script>
+&lt;!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+&lt;script>parent.alert('step 2 of 3 ("þ")')&lt;/script>
+&lt;meta charset="ISO-8859-9">
+&lt;script>parent.alert('step 3 of 3 ("þ")')&lt;/script></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/056.html b/LayoutTests/fast/encoding/resources/056.html
new file mode 100644
index 0000000..b4772b7
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/056.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<script>document.write('<meta charset="ISO-8859-' + '9">')</script>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;script>document.write('&lt;meta charset="ISO-8859-' + '9">')&lt;/script></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/057.html b/LayoutTests/fast/encoding/resources/057.html
new file mode 100644
index 0000000..9c78ab0
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/057.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<script>var s = '9">'; document.write('<meta charset="ISO-8859-' + s)</script>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;script>var s = '9">'; document.write('&lt;meta charset="ISO-8859-' + s)&lt;/script></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/058.html b/LayoutTests/fast/encoding/resources/058.html
new file mode 100644
index 0000000..d63c90e
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/058.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<script>document.write('<meta charset="ISO-8859-9">')</script>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;script>document.write('&lt;meta charset="ISO-8859-9">')&lt;/script></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/059.html b/LayoutTests/fast/encoding/resources/059.html
new file mode 100644
index 0000000..be8d1e6
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/059.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<script type="text/plain"><meta charset="ISO-8859-9"></script>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;script type="text/plain">&lt;meta charset="ISO-8859-9">&lt;/script></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/060.html b/LayoutTests/fast/encoding/resources/060.html
new file mode 100644
index 0000000..30dfb79
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/060.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<style type="text/plain"><meta charset="ISO-8859-9"></style>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;style type="text/plain">&lt;meta charset="ISO-8859-9">&lt;/style></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/061.html b/LayoutTests/fast/encoding/resources/061.html
new file mode 100644
index 0000000..b3b6e4a
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/061.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<p><meta charset="ISO-8859-9"></p>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;p>&lt;meta charset="ISO-8859-9">&lt;/p></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/062.html b/LayoutTests/fast/encoding/resources/062.html
new file mode 100644
index 0000000..07e2b7a
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/062.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<meta charset="bogus">
+<meta charset="ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta charset="bogus">
+&lt;meta charset="ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/063.html b/LayoutTests/fast/encoding/resources/063.html
new file mode 100644
index 0000000..b1e3e5f
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/063.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<script type="text/plain"><meta charset="ISO-8859-9"></script>
+<meta charset="ISO-8859-1">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;script type="text/plain">&lt;meta charset="ISO-8859-9">&lt;/script>
+&lt;meta charset="ISO-8859-1"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/064.html b/LayoutTests/fast/encoding/resources/064.html
new file mode 100644
index 0000000..19fc171
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/064.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<style type="text/plain"><meta charset="ISO-8859-9"></style>
+<meta charset="ISO-8859-1">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;style type="text/plain">&lt;meta charset="ISO-8859-9">&lt;/style>
+&lt;meta charset="ISO-8859-1"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/065.html b/LayoutTests/fast/encoding/resources/065.html
new file mode 100644
index 0000000..c0fe2d2
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/065.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<meta charset=" 	
+ISO-8859-9	 ">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta charset=" 	
+ISO-8859-9	 "></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/066.html b/LayoutTests/fast/encoding/resources/066.html
new file mode 100644
index 0000000..b3b24c9
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/066.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<meta content="text/html;charset=' 	
+ISO-8859-9	 '">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta content="text/html;charset=' 	
+ISO-8859-9	 '"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/067.html b/LayoutTests/fast/encoding/resources/067.html
new file mode 100644
index 0000000..0ef69dc
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/067.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta charset=" ISO-8859-9 ">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta charset=" ISO-8859-9 "></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/068.html b/LayoutTests/fast/encoding/resources/068.html
new file mode 100644
index 0000000..1d20faa
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/068.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta content="text/html;charset=' ISO-8859-9 '">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta content="text/html;charset=' ISO-8859-9 '"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/069.html b/LayoutTests/fast/encoding/resources/069.html
new file mode 100644
index 0000000..8cff55a
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/069.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" charset=" 	
+ISO-8859-9	 ">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" charset=" 	
+ISO-8859-9	 "></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/070.html b/LayoutTests/fast/encoding/resources/070.html
new file mode 100644
index 0000000..a9cc860
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/070.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charset=' 	
+ISO-8859-9	 '">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charset=' 	
+ISO-8859-9	 '"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/071.html b/LayoutTests/fast/encoding/resources/071.html
new file mode 100644
index 0000000..cad0a0a
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/071.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" charset=" ISO-8859-9 ">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" charset=" ISO-8859-9 "></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/072.html b/LayoutTests/fast/encoding/resources/072.html
new file mode 100644
index 0000000..60b64a5
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/072.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charset=' ISO-8859-9 '">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charset=' ISO-8859-9 '"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/073.html b/LayoutTests/fast/encoding/resources/073.html
new file mode 100644
index 0000000..187918a
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/073.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charset='ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charset='ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/074.html b/LayoutTests/fast/encoding/resources/074.html
new file mode 100644
index 0000000..2a89ae5
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/074.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charset=&quot;ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charset=&amp;quot;ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/075.html b/LayoutTests/fast/encoding/resources/075.html
new file mode 100644
index 0000000..444b9e6
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/075.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charset='ISO-8859-9'">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charset='ISO-8859-9'"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/076.html b/LayoutTests/fast/encoding/resources/076.html
new file mode 100644
index 0000000..b01a21b
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/076.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charset=&quot;ISO-8859-9&quot;">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charset=&amp;quot;ISO-8859-9&amp;quot;"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/077.html b/LayoutTests/fast/encoding/resources/077.html
new file mode 100644
index 0000000..549162e
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/077.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charset='ISO-8859-9';">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charset='ISO-8859-9';"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/078.html b/LayoutTests/fast/encoding/resources/078.html
new file mode 100644
index 0000000..09e7ff6
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/078.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charset=&quot;ISO-8859-9&quot;;">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charset=&amp;quot;ISO-8859-9&amp;quot;;"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/079.html b/LayoutTests/fast/encoding/resources/079.html
new file mode 100644
index 0000000..4638f84
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/079.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-9;">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-9;"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/080.html b/LayoutTests/fast/encoding/resources/080.html
new file mode 100644
index 0000000..6c75a01
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/080.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-9 x">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-9 x"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/081.html b/LayoutTests/fast/encoding/resources/081.html
new file mode 100644
index 0000000..71da96f
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/081.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-9x">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-9x"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/082.html b/LayoutTests/fast/encoding/resources/082.html
new file mode 100644
index 0000000..db73b67
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/082.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charsetx=ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charsetx=ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/083.html b/LayoutTests/fast/encoding/resources/083.html
new file mode 100644
index 0000000..7ab94bd
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/083.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charset:ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charset:ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/084.html b/LayoutTests/fast/encoding/resources/084.html
new file mode 100644
index 0000000..5f1256a
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/084.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charsetx=ISO-8859-3;charset=ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charsetx=ISO-8859-3;charset=ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/085.html b/LayoutTests/fast/encoding/resources/085.html
new file mode 100644
index 0000000..e323934
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/085.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="TEXT/HTML;CHARSET=ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;META HTTP-EQUIV="CONTENT-TYPE" CONTENT="TEXT/HTML;CHARSET=ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/086.html b/LayoutTests/fast/encoding/resources/086.html
new file mode 100644
index 0000000..bcfbe59
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/086.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html charset=ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html charset=ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/087.html b/LayoutTests/fast/encoding/resources/087.html
new file mode 100644
index 0000000..b84cf08
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/087.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html charset ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html charset ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/088.html b/LayoutTests/fast/encoding/resources/088.html
new file mode 100644
index 0000000..0939b1e
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/088.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html charset = ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html charset = ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/089.html b/LayoutTests/fast/encoding/resources/089.html
new file mode 100644
index 0000000..ec37fea
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/089.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html charset = 'ISO-8859-9'">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html charset = 'ISO-8859-9'"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/090.html b/LayoutTests/fast/encoding/resources/090.html
new file mode 100644
index 0000000..dd2af80
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/090.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;xcharset=ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;xcharset=ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/091.html b/LayoutTests/fast/encoding/resources/091.html
new file mode 100644
index 0000000..dfcc13b
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/091.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;x charset=ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;x charset=ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/092.html b/LayoutTests/fast/encoding/resources/092.html
new file mode 100644
index 0000000..027b28b
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/092.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html x charset=ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html x charset=ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/093.html b/LayoutTests/fast/encoding/resources/093.html
new file mode 100644
index 0000000..b3c2e67
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/093.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charsetcharset=ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charsetcharset=ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/094.html b/LayoutTests/fast/encoding/resources/094.html
new file mode 100644
index 0000000..ff47bac
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/094.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charsetxcharset=ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charsetxcharset=ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/095.html b/LayoutTests/fast/encoding/resources/095.html
new file mode 100644
index 0000000..d75e931
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/095.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charsetxxcharset=ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charsetxxcharset=ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/096.html b/LayoutTests/fast/encoding/resources/096.html
new file mode 100644
index 0000000..3118236
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/096.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-9">
+<!-- control for next test -->
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-9">
+&lt;!-- control for next test --></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/097.html b/LayoutTests/fast/encoding/resources/097.html
new file mode 100644
index 0000000..bd4135c
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/097.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<script>document.write(atob('PG1ldGEgaHR0cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7Y2hhcnNldD1JU08tODg1OS05Ij4='))</script>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;script>document.write(atob('PG1ldGEgaHR0cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7Y2hhcnNldD1JU08tODg1OS05Ij4='))&lt;/script></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/098.html b/LayoutTests/fast/encoding/resources/098.html
new file mode 100644
index 0000000..65ea60d
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/098.html
@@ -0,0 +1,70 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
+<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-9">
+<!-- control for next four tests -->
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
+&lt;meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-9">
+&lt;!-- control for next four tests --></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/099.html b/LayoutTests/fast/encoding/resources/099.html
new file mode 100644
index 0000000..bdd0529
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/099.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<script>document.write(atob('PG1ldGEgaHR0cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7Y2hhcnNldD1JU08tODg1OS0xIj4='))</script>
+<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;script>document.write(atob('PG1ldGEgaHR0cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7Y2hhcnNldD1JU08tODg1OS0xIj4='))&lt;/script>
+&lt;meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/100.html b/LayoutTests/fast/encoding/resources/100.html
new file mode 100644
index 0000000..af063a9
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/100.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
+<script>document.write(atob('PG1ldGEgaHR0cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7Y2hhcnNldD1JU08tODg1OS05Ij4='))</script>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
+&lt;script>document.write(atob('PG1ldGEgaHR0cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7Y2hhcnNldD1JU08tODg1OS05Ij4='))&lt;/script></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/101.html b/LayoutTests/fast/encoding/resources/101.html
new file mode 100644
index 0000000..9deb659
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/101.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<script>document.write(atob('PG1ldGEgaHR0cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7Y2hhcnNldD1JU08tODg1OS0xIj4='))</script>
+<script>document.write(atob('PG1ldGEgaHR0cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7Y2hhcnNldD1JU08tODg1OS05Ij4='))</script>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;script>document.write(atob('PG1ldGEgaHR0cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7Y2hhcnNldD1JU08tODg1OS0xIj4='))&lt;/script>
+&lt;script>document.write(atob('PG1ldGEgaHR0cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7Y2hhcnNldD1JU08tODg1OS05Ij4='))&lt;/script></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/102.html b/LayoutTests/fast/encoding/resources/102.html
new file mode 100644
index 0000000..9058fcd
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/102.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<script>document.write(atob('PG1ldGEgaHR0cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7Y2hhcnNldD1JU08tODg1OS05Ij4='))</script>
+<script>document.write(atob('PG1ldGEgaHR0cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7Y2hhcnNldD1JU08tODg1OS0xIj4='))</script>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;script>document.write(atob('PG1ldGEgaHR0cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7Y2hhcnNldD1JU08tODg1OS05Ij4='))&lt;/script>
+&lt;script>document.write(atob('PG1ldGEgaHR0cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7Y2hhcnNldD1JU08tODg1OS0xIj4='))&lt;/script></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/103.html b/LayoutTests/fast/encoding/resources/103.html
new file mode 100644
index 0000000..110f8ee
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/103.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charset0charset=ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charset0charset=ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/104.html b/LayoutTests/fast/encoding/resources/104.html
new file mode 100644
index 0000000..358336f
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/104.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charset-charset=ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charset-charset=ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/105.html b/LayoutTests/fast/encoding/resources/105.html
new file mode 100644
index 0000000..da406fc
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/105.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charset!charset=ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charset!charset=ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/106.html b/LayoutTests/fast/encoding/resources/106.html
new file mode 100644
index 0000000..000bd58
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/106.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charset;charset=ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charset;charset=ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/107.html b/LayoutTests/fast/encoding/resources/107.html
new file mode 100644
index 0000000..8362798
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/107.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charset=charset=ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charset=charset=ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/108.html b/LayoutTests/fast/encoding/resources/108.html
new file mode 100644
index 0000000..c07bf87
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/108.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charset charset=ISO-8859-9">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charset charset=ISO-8859-9"></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/109.html b/LayoutTests/fast/encoding/resources/109.html
new file mode 100644
index 0000000..2f0b6de
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/109.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta content=" text/html; charset = ISO-8859-9 " http-equiv="Content-Type" >
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta content=" text/html; charset = ISO-8859-9 " http-equiv="Content-Type" ></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/110.html b/LayoutTests/fast/encoding/resources/110.html
new file mode 100644
index 0000000..ca10669
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/110.html
@@ -0,0 +1,74 @@
+<!DOCTYPE HTML>
+<meta content="
+text/html; charset=ISO-8859-9
+"
+http-equiv="Content-Type"
+>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta content="
+text/html; charset=ISO-8859-9
+"
+http-equiv="Content-Type"
+></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/111.html b/LayoutTests/fast/encoding/resources/111.html
new file mode 100644
index 0000000..d53ae88
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/111.html
@@ -0,0 +1,84 @@
+<!DOCTYPE HTML>
+<meta
+content
+=
+"
+text/html; charset=ISO-8859-9
+"
+http-equiv
+=
+"Content-Type"
+>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta
+content
+=
+"
+text/html; charset=ISO-8859-9
+"
+http-equiv
+=
+"Content-Type"
+></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/112.html b/LayoutTests/fast/encoding/resources/112.html
new file mode 100644
index 0000000..7a8378e
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/112.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content='text/html;charset="ISO-8859-9"'> <!-- control for next test -->
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content='text/html;charset="ISO-8859-9"'> &lt;!-- control for next test --></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/113.html b/LayoutTests/fast/encoding/resources/113.html
new file mode 100644
index 0000000..f169cf9
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/113.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content='text/html;charset="IS\O-8859-9"'>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content='text/html;charset="IS\O-8859-9"'></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/114.html b/LayoutTests/fast/encoding/resources/114.html
new file mode 100644
index 0000000..8519eda
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/114.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content='text/html;charset="IS/O-8859-9"'>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content='text/html;charset="IS/O-8859-9"'></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/115.html b/LayoutTests/fast/encoding/resources/115.html
new file mode 100644
index 0000000..ffdcefc
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/115.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charset=&quot;ISO-8859-9&quot;"> <!-- control for next test -->
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charset=&amp;quot;ISO-8859-9&amp;quot;"> &lt;!-- control for next test --></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/116.html b/LayoutTests/fast/encoding/resources/116.html
new file mode 100644
index 0000000..97632aa
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/116.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charset=&quot;IS\O-8859-9&quot;">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charset=&amp;quot;IS\O-8859-9&amp;quot;"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/117.html b/LayoutTests/fast/encoding/resources/117.html
new file mode 100644
index 0000000..695c45c
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/117.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content="text/html;charset=&quot;IS/O-8859-9&quot;">
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content="text/html;charset=&amp;quot;IS/O-8859-9&amp;quot;"></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/118.html b/LayoutTests/fast/encoding/resources/118.html
new file mode 100644
index 0000000..23022d7
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/118.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content='text/html;charset=IS\O-8859-9'>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content='text/html;charset=IS\O-8859-9'></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/119.html b/LayoutTests/fast/encoding/resources/119.html
new file mode 100644
index 0000000..58970a1
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/119.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content='text/html;charset=IS/O-8859-9'>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content='text/html;charset=IS/O-8859-9'></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/120.html b/LayoutTests/fast/encoding/resources/120.html
new file mode 100644
index 0000000..58970a1
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/120.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content='text/html;charset=IS/O-8859-9'>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content='text/html;charset=IS/O-8859-9'></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/121.html b/LayoutTests/fast/encoding/resources/121.html
new file mode 100644
index 0000000..5cdce36
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/121.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content='text/html;charset=IS\\O!8!8!5!9*9'>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content='text/html;charset=IS\\O!8!8!5!9*9'></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/122.html b/LayoutTests/fast/encoding/resources/122.html
new file mode 100644
index 0000000..fdbb8c4
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/122.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content='text/html;charset="ISO-8859-1\"5"'>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content='text/html;charset="ISO-8859-1\"5"'></pre>
+<p>Expected result: <span id="expected">Windows-1252</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/resources/123.html b/LayoutTests/fast/encoding/resources/123.html
new file mode 100644
index 0000000..25cdeb8
--- /dev/null
+++ b/LayoutTests/fast/encoding/resources/123.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<meta http-equiv="Content-Type" content='text/html;bogus="\";charset=ISO-8859-9;bogus="'>
+<p>Test:
+<pre>&lt;!DOCTYPE HTML>
+&lt;meta http-equiv="Content-Type" content='text/html;bogus="\";charset=ISO-8859-9;bogus="'></pre>
+<p>Expected result: <span id="expected">Windows-1254</span>
+<div>
+ <style scoped>
+  .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
+  .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
+ </style>
+ <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
+ <p>Result: <span id="result">Script did not run.</span>
+ <script>
+   var encoding = 'unknown';
+   if ('à' == '\u00E0') { // 0xE0
+     if ('™' == '\u2122') { // 0x99
+       if ('þ' == '\u00FE') // 0xFE
+         encoding = 'Windows-1252';
+       else if ('þ' == '\u015F')
+         encoding = 'Windows-1254';
+       else if ('þ' == '\u200F')
+         encoding = 'Windows-1256';
+       else if ('þ' == '\u20AB')
+         encoding = 'Windows-1258';
+       else
+         encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
+     } else if ('ÿ' == '\u02D9') // 0xFF
+       encoding = 'ISO-8859-3';
+     else if ('þ' == '\u0177') // 0xFE
+       encoding = 'ISO-8859-14';
+     else if ('þ' == '\u021B')
+       encoding = 'ISO-8859-16';
+     else if ('þ' == '\u015F')
+       encoding = 'ISO-8859-9';
+     else if ('¾' == '\u00BE') // 0xBE
+       encoding = 'ISO-8859-1';
+     else if ('¾' == '\u0178')
+       encoding = 'ISO-8859-15';
+     else
+       encoding = 'unknown with 0xE0 = U+00E0';
+   } else if ('à' == '\u0101') // 0xE0
+     encoding = 'ISO-8859-10';
+   else if ('à' == '\u0E40') // 0xE0
+     encoding = 'ISO-8859-11';
+   else if ('à' == '\uFFFD') { // 0xE0
+     if ('☺' == '\u263A') // 0xE2 0x98 0xBA
+       encoding = 'UTF-8';
+     else
+       encoding = 'unknown (but ASCII-compatible)';
+   }
+   document.getElementById('encoding').firstChild.data = encoding;
+   var expected = document.getElementById('expected').firstChild.data;
+   if (expected == '(demo - no expected result)') {
+     document.getElementById('result').firstChild.data = 'demo';
+   } else if (encoding == expected) {
+     document.getElementById('result').firstChild.data = 'PASS';
+     document.getElementById('result').className = 'pass';
+   } else {
+     document.getElementById('result').firstChild.data = 'FAIL';
+     document.getElementById('result').className = 'fail';
+   }
+   if (parent.receivedResults)
+     parent.receivedResults();
+ </script>
+</div>
diff --git a/LayoutTests/fast/encoding/tag-name-digit-expected.txt b/LayoutTests/fast/encoding/tag-name-digit-expected.txt
new file mode 100644
index 0000000..0ba3825
--- /dev/null
+++ b/LayoutTests/fast/encoding/tag-name-digit-expected.txt
@@ -0,0 +1,3 @@
+<0notatag>
+PASS: windows-1255
+This test checks that charset sniffer does not get confused by text that looks like a tag whose name begins with a digit.
diff --git a/LayoutTests/fast/encoding/tag-name-digit.html b/LayoutTests/fast/encoding/tag-name-digit.html
new file mode 100644
index 0000000..209f506
--- /dev/null
+++ b/LayoutTests/fast/encoding/tag-name-digit.html
@@ -0,0 +1,26 @@
+<html>
+<title>Test a tag name that begins with a digit</title>
+<0notatag>
+<!-- at least 1024 bytes to test that a meta tag after 1024 bytes will still be considered, indicating the bogus tag name was not treated as a tag that ends the head section.
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+-->
+<meta charset=windows-1255>
+<body>
+<pre id="log"></pre>
+<script>
+function log(message)
+{
+    document.getElementById("log").innerText += message + "\n";
+}
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+if (document.inputEncoding == "windows-1255")
+    log("PASS: " + document.inputEncoding);
+else
+    log("FAIL: " + document.inputEncoding);
+</script>
+<p>This test checks that charset sniffer does not get confused by text that looks like a tag whose name begins with a digit.</p>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/international/bidi-innertext.html b/LayoutTests/fast/text/international/bidi-innertext.html
index ad909d7..d017501 100644
--- a/LayoutTests/fast/text/international/bidi-innertext.html
+++ b/LayoutTests/fast/text/international/bidi-innertext.html
@@ -1,5 +1,5 @@
 <html>
-    <meta name="content-type" content="text/html; charset=utf-8">
+    <meta http-equiv="content-type" content="text/html; charset=utf-8">
     <script>
     function print(message)
     {
diff --git a/LayoutTests/http/tests/misc/charset-sniffer-end-sniffing-expected.txt b/LayoutTests/http/tests/misc/charset-sniffer-end-sniffing-expected.txt
new file mode 100644
index 0000000..c664f55
--- /dev/null
+++ b/LayoutTests/http/tests/misc/charset-sniffer-end-sniffing-expected.txt
@@ -0,0 +1,5 @@
+Running first script.
+Running second script.
+PASS: First script ran before second script was loaded.
+
+This test is for a bug where the charset sniffer would not stop looking for charset if the body contains no tags. Charset sniffer is supposed to stop looking for charset after 1024 bytes.
diff --git a/LayoutTests/http/tests/misc/charset-sniffer-end-sniffing.html b/LayoutTests/http/tests/misc/charset-sniffer-end-sniffing.html
new file mode 100644
index 0000000..b66ed63
--- /dev/null
+++ b/LayoutTests/http/tests/misc/charset-sniffer-end-sniffing.html
@@ -0,0 +1,51 @@
+<html>
+<script>
+
+var time1 = 0;
+var time2 = 0;
+
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+    document.getElementById("log").innerText += message + "\n";
+}
+
+function firstScript()
+{
+    log("Running first script.");
+    time1 = new Date().getTime();
+}
+
+function secondScript()
+{
+    log("Running second script.");
+    time2 = new Date().getTime();
+}
+
+function test()
+{
+    // Second script is sent after a 1 second delay. If time delta
+    // between both scripts running is really small, that means they
+    // ran back-to-back instead of the first script running before
+    // the second script was loaded.
+    if (time2 - time1 < 50)
+        log("FAIL: Gap between script runs unexpectedly small.");
+    else
+        log("PASS: First script ran before second script was loaded.");
+
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}
+</script>
+<body onload="test()">
+<pre id="log"></pre>
+<iframe id="frame" src="resources/charset-sniffer-end-sniffing.php"></iframe>
+<p>This test is for a bug where the charset sniffer would not stop looking
+for charset if the body contains no tags. Charset sniffer is supposed to stop
+looking for charset after 1024 bytes.</p>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/misc/resources/charset-sniffer-end-sniffing.php b/LayoutTests/http/tests/misc/resources/charset-sniffer-end-sniffing.php
new file mode 100644
index 0000000..cec16e7
--- /dev/null
+++ b/LayoutTests/http/tests/misc/resources/charset-sniffer-end-sniffing.php
@@ -0,0 +1,21 @@
+<?php
+header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
+header("Cache-Control: no-cache, no-store, must-revalidate");
+header("Pragma: no-cache");
+header("Content-Type: text/html");
+
+echo "<html><script>parent.firstScript();</script>\n";
+
+// Dump a lot of text to exceed 1024 chars after finishing the head section.
+echo "<body>\n";
+for ($i = 0; $i < 10000; ++$i)
+    echo "a";
+
+// Send off the first portion so it executes before the rest is received.
+ob_flush();
+flush();
+sleep(1);
+
+echo "<html><script>parent.secondScript();</script>\n";
+echo "</body></html>\n";
+?>
diff --git a/WebCore/Android.mk b/WebCore/Android.mk
index cf926f5..f780310 100644
--- a/WebCore/Android.mk
+++ b/WebCore/Android.mk
@@ -334,6 +334,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
 	html/parser/HTMLElementStack.cpp \
 	html/parser/HTMLEntityParser.cpp \
 	html/parser/HTMLFormattingElementList.cpp \
+	html/parser/HTMLMetaCharsetParser.cpp \
 	html/parser/HTMLParserIdioms.cpp \
 	html/parser/HTMLParserScheduler.cpp \
 	html/parser/HTMLPreloadScanner.cpp \
diff --git a/WebCore/CMakeLists.txt b/WebCore/CMakeLists.txt
index db7ab24..e50e8d6 100644
--- a/WebCore/CMakeLists.txt
+++ b/WebCore/CMakeLists.txt
@@ -1131,6 +1131,7 @@ SET(WebCore_SOURCES
     html/parser/HTMLParserIdioms.cpp
     html/parser/HTMLParserScheduler.cpp
     html/parser/HTMLFormattingElementList.cpp
+    html/parser/HTMLMetaCharsetParser.cpp
     html/parser/HTMLPreloadScanner.cpp
     html/parser/HTMLScriptRunner.cpp
     html/parser/HTMLTokenizer.cpp
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 96d1cc1..925f2b5 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,49 @@
+2010-12-09  Jenn Braithwaite  <jennb at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        TextResourceDecoder::checkForHeadCharset can look way past the limit.
+        https://bugs.webkit.org/show_bug.cgi?id=47397
+
+        Replaced charset detection algorithm with real parser.
+        Added tests for parser bugs mentioned in the thread for this bug report.
+        Converted hixie's encoding parsing tests to a layout test.
+
+        Tests: fast/encoding/bracket-in-script.html
+               fast/encoding/bracket-in-tag.html
+               fast/encoding/escaped-bracket.html
+               fast/encoding/meta-in-body.html
+               fast/encoding/meta-in-script.html
+               fast/encoding/meta-in-title.html
+               fast/encoding/mismatched-end-tag.html
+               fast/encoding/namespace-meta.html
+               fast/encoding/not-http-equiv-content.html
+               fast/encoding/parser-tests.html
+               fast/encoding/quotes-in-title.html
+               fast/encoding/tag-name-digit.html
+               http/tests/misc/charset-sniffer-end-sniffing.html
+
+        * Android.mk:
+        * CMakeLists.txt:
+        * GNUmakefile.am:
+        * WebCore.gypi:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * html/parser/HTMLMetaCharsetParser.cpp: Added.
+        (WebCore::HTMLMetaCharsetParser::HTMLMetaCharsetParser):
+        (WebCore::HTMLMetaCharsetParser::~HTMLMetaCharsetParser):
+        (WebCore::HTMLMetaCharsetParser::extractCharset):
+        (WebCore::HTMLMetaCharsetParser::processMeta):
+        (WebCore::HTMLMetaCharsetParser::checkForMetaCharset):
+        * html/parser/HTMLMetaCharsetParser.h: Added.
+        (WebCore::HTMLMetaCharsetParser::create):
+        (WebCore::HTMLMetaCharsetParser::encoding):
+        * loader/TextResourceDecoder.cpp:
+        (WebCore::TextResourceDecoder::checkForHeadCharset):
+        (WebCore::TextResourceDecoder::checkForMetaCharset):
+        * loader/TextResourceDecoder.h:
+
 2010-12-10 Nate Chapin  <japhet at chromium.org>
 
         Reviewed by Antti Koivisto.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 022dbb7..9053976 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -1827,6 +1827,8 @@ webcore_sources += \
 	WebCore/html/parser/HTMLFormattingElementList.cpp \
 	WebCore/html/parser/HTMLFormattingElementList.h \
 	WebCore/html/parser/HTMLInputStream.h \
+	WebCore/html/parser/HTMLMetaCharsetParser.cpp \
+	WebCore/html/parser/HTMLMetaCharsetParser.h \
 	WebCore/html/parser/HTMLParserIdioms.cpp \
 	WebCore/html/parser/HTMLParserIdioms.h \
 	WebCore/html/parser/HTMLParserScheduler.cpp \
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 1cfe59f..fca49ea 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -1959,6 +1959,8 @@
             'html/parser/HTMLFormattingElementList.cpp',
             'html/parser/HTMLFormattingElementList.h',
             'html/parser/HTMLInputStream.h',
+            'html/parser/HTMLMetaCharsetParser.cpp',
+            'html/parser/HTMLMetaCharsetParser.h',
             'html/parser/HTMLParserIdioms.cpp',
             'html/parser/HTMLParserIdioms.h',
             'html/parser/HTMLParserScheduler.cpp',
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 07b7e8a..b915789 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -1009,6 +1009,7 @@ SOURCES += \
     html/parser/HTMLEntityParser.cpp \
     html/parser/HTMLEntitySearch.cpp \
     html/parser/HTMLFormattingElementList.cpp \
+    html/parser/HTMLMetaCharsetParser.cpp \
     html/parser/HTMLParserIdioms.cpp \
     html/parser/HTMLParserScheduler.cpp \
     html/parser/HTMLPreloadScanner.cpp \
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 1fb056a..1ee3355 100755
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -55162,6 +55162,14 @@
 					>
 				</File>
 				<File
+					RelativePath="..\html\parser\HTMLMetaCharsetParser.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\html\parser\HTMLMetaCharsetParser.h"
+					>
+				</File>
+				<File
 					RelativePath="..\html\parser\HTMLParserIdioms.cpp"
 					>
 				</File>
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 3403e2f..58b51c3 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -726,6 +726,8 @@
 		29A812490FBB9CA900510293 /* AccessibilityObjectWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 29A812450FBB9CA900510293 /* AccessibilityObjectWrapper.h */; };
 		29A8124A0FBB9CA900510293 /* AccessibilityObjectWrapper.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29A812460FBB9CA900510293 /* AccessibilityObjectWrapper.mm */; };
 		29A8124B0FBB9CA900510293 /* AXObjectCacheMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29A812470FBB9CA900510293 /* AXObjectCacheMac.mm */; };
+		2BE8E2C712A589EC00FAD550 /* HTMLMetaCharsetParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BE8E2C612A589EC00FAD550 /* HTMLMetaCharsetParser.h */; };
+		2BE8E2C912A58A0100FAD550 /* HTMLMetaCharsetParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BE8E2C812A58A0100FAD550 /* HTMLMetaCharsetParser.cpp */; };
 		2D9066060BE141D400956998 /* LayoutState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D9066040BE141D400956998 /* LayoutState.cpp */; };
 		2D9066070BE141D400956998 /* LayoutState.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D9066050BE141D400956998 /* LayoutState.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		2E0888D41148848A00AF4265 /* JSDOMFormData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E0888D21148848A00AF4265 /* JSDOMFormData.cpp */; };
@@ -7001,6 +7003,8 @@
 		29A812450FBB9CA900510293 /* AccessibilityObjectWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityObjectWrapper.h; sourceTree = "<group>"; };
 		29A812460FBB9CA900510293 /* AccessibilityObjectWrapper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AccessibilityObjectWrapper.mm; sourceTree = "<group>"; };
 		29A812470FBB9CA900510293 /* AXObjectCacheMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AXObjectCacheMac.mm; sourceTree = "<group>"; };
+		2BE8E2C612A589EC00FAD550 /* HTMLMetaCharsetParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTMLMetaCharsetParser.h; path = parser/HTMLMetaCharsetParser.h; sourceTree = "<group>"; };
+		2BE8E2C812A58A0100FAD550 /* HTMLMetaCharsetParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HTMLMetaCharsetParser.cpp; path = parser/HTMLMetaCharsetParser.cpp; sourceTree = "<group>"; };
 		2D9066040BE141D400956998 /* LayoutState.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutState.cpp; sourceTree = "<group>"; };
 		2D9066050BE141D400956998 /* LayoutState.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = LayoutState.h; sourceTree = "<group>"; };
 		2D90660B0665D937006B6F1A /* ClipboardMac.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = ClipboardMac.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
@@ -15642,6 +15646,8 @@
 				977B3855122883E900B81FF8 /* HTMLFormattingElementList.cpp */,
 				977B3856122883E900B81FF8 /* HTMLFormattingElementList.h */,
 				97BC849A12370A4B000C6161 /* HTMLInputStream.h */,
+				2BE8E2C812A58A0100FAD550 /* HTMLMetaCharsetParser.cpp */,
+				2BE8E2C612A589EC00FAD550 /* HTMLMetaCharsetParser.h */,
 				93E2A304123E9DC0009FE12A /* HTMLParserIdioms.cpp */,
 				93E2A305123E9DC0009FE12A /* HTMLParserIdioms.h */,
 				977B3857122883E900B81FF8 /* HTMLParserScheduler.cpp */,
@@ -20489,6 +20495,7 @@
 				A8EA7CAB0A192B9C00A8EF5F /* HTMLMarqueeElement.h in Headers */,
 				E44613A50CD6331000FADA75 /* HTMLMediaElement.h in Headers */,
 				A8EA79F40A1916DF00A8EF5F /* HTMLMenuElement.h in Headers */,
+				2BE8E2C712A589EC00FAD550 /* HTMLMetaCharsetParser.h in Headers */,
 				A871DC240A15205700B12A68 /* HTMLMetaElement.h in Headers */,
 				A454424B119B3661009BE912 /* HTMLMeterElement.h in Headers */,
 				A8CFF7A70A156978000A4234 /* HTMLModElement.h in Headers */,
@@ -23217,6 +23224,7 @@
 				A8EA7CAC0A192B9C00A8EF5F /* HTMLMarqueeElement.cpp in Sources */,
 				E44613A40CD6331000FADA75 /* HTMLMediaElement.cpp in Sources */,
 				A8EA79F80A1916DF00A8EF5F /* HTMLMenuElement.cpp in Sources */,
+				2BE8E2C912A58A0100FAD550 /* HTMLMetaCharsetParser.cpp in Sources */,
 				A871DC270A15205700B12A68 /* HTMLMetaElement.cpp in Sources */,
 				A454424A119B3661009BE912 /* HTMLMeterElement.cpp in Sources */,
 				A8CFF7A90A156978000A4234 /* HTMLModElement.cpp in Sources */,
diff --git a/WebCore/html/parser/HTMLMetaCharsetParser.cpp b/WebCore/html/parser/HTMLMetaCharsetParser.cpp
new file mode 100644
index 0000000..eac7d28
--- /dev/null
+++ b/WebCore/html/parser/HTMLMetaCharsetParser.cpp
@@ -0,0 +1,200 @@
+/*
+ * Copyright (C) 2010 Google Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "HTMLMetaCharsetParser.h"
+
+#include "HTMLNames.h"
+#include "HTMLParserIdioms.h"
+#include "HTMLTokenizer.h"
+#include "PlatformString.h"
+#include "TextCodec.h"
+#include "TextEncodingRegistry.h"
+
+using namespace WTF;
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+HTMLMetaCharsetParser::HTMLMetaCharsetParser()
+    : m_tokenizer(HTMLTokenizer::create(false)) // No pre-HTML5 parser quirks.
+    , m_assumedCodec(newTextCodec(Latin1Encoding()))
+    , m_inHeadSection(true)
+    , m_doneChecking(false)
+{
+}
+
+HTMLMetaCharsetParser::~HTMLMetaCharsetParser()
+{
+}
+
+static const char charsetString[] = "charset";
+static const size_t charsetLength = sizeof("charset") - 1;
+
+String HTMLMetaCharsetParser::extractCharset(const String& value)
+{
+    size_t pos = 0;
+    unsigned length = value.length();
+
+    while (pos < length) {
+        pos = value.find(charsetString, pos, false);
+        if (pos == notFound)
+            break;
+
+        pos += charsetLength;
+
+        // Skip whitespace.
+        while (pos < length && value[pos] <= ' ')
+            ++pos;
+
+        if (value[pos] != '=')
+            continue;
+
+        ++pos;
+
+        while (pos < length && value[pos] <= ' ')
+            ++pos;
+
+        char quoteMark = 0;
+        if (pos < length && (value[pos] == '"' || value[pos] == '\'')) {
+            quoteMark = static_cast<char>(value[pos++]);
+            ASSERT(!(quoteMark & 0x80));
+        }
+            
+        if (pos == length)
+            break;
+
+        unsigned end = pos;
+        while (end < length && ((quoteMark && value[end] != quoteMark) || (!quoteMark && value[end] > ' ' && value[end] != '"' && value[end] != '\'' && value[end] != ';')))
+            ++end;
+
+        if (quoteMark && (end == length))
+            break; // Close quote not found.
+
+        return value.substring(pos, end - pos);
+    }
+
+    return "";
+}
+
+bool HTMLMetaCharsetParser::processMeta()
+{
+    bool gotPragma = false;
+    Mode mode = None;
+    String charset;
+
+    const HTMLToken::AttributeList& attributes = m_token.attributes();
+    for (HTMLToken::AttributeList::const_iterator iter = attributes.begin();
+         iter != attributes.end(); ++iter) {
+        AtomicString attributeName(iter->m_name.data(), iter->m_name.size());
+        String attributeValue(iter->m_value.data(), iter->m_value.size());
+
+        if (attributeName == http_equivAttr) {
+            if (equalIgnoringCase(attributeValue, "content-type"))
+                gotPragma = true;
+        } else if (charset.isEmpty()) {
+            if (attributeName == charsetAttr) {
+                charset = attributeValue;
+                mode = Charset;
+            } else if (attributeName == contentAttr) {
+                charset = extractCharset(attributeValue);
+                if (charset.length())
+                    mode = Pragma;
+            }
+        }
+    }
+
+    if (mode == Charset || (mode == Pragma && gotPragma)) {
+        m_encoding = TextEncoding(stripLeadingAndTrailingHTMLSpaces(charset));
+        if (m_encoding.isValid())
+            return true;
+    }
+
+    return false;
+}
+
+static const int bytesToCheckUnconditionally = 1024; // That many input bytes will be checked for meta charset even if <head> section is over.
+
+bool HTMLMetaCharsetParser::checkForMetaCharset(const char* data, size_t length)
+{
+    if (m_doneChecking)
+        return true;
+
+    ASSERT(!m_encoding.isValid());
+
+    // We still don't have an encoding, and are in the head.
+    // The following tags are allowed in <head>:
+    // SCRIPT|STYLE|META|LINK|OBJECT|TITLE|BASE
+
+    // We stop scanning when a tag that is not permitted in <head>
+    // is seen, rather when </head> is seen, because that more closely
+    // matches behavior in other browsers; more details in
+    // <http://bugs.webkit.org/show_bug.cgi?id=3590>.
+
+    // Additionally, we ignore things that looks like tags in <title>, <script>
+    // and <noscript>; see <http://bugs.webkit.org/show_bug.cgi?id=4560>,
+    // <http://bugs.webkit.org/show_bug.cgi?id=12165> and
+    // <http://bugs.webkit.org/show_bug.cgi?id=12389>.
+
+    // Since many sites have charset declarations after <body> or other tags
+    // that are disallowed in <head>, we don't bail out until we've checked at
+    // least bytesToCheckUnconditionally bytes of input.
+
+    m_input.append(SegmentedString(m_assumedCodec->decode(data, length)));
+
+    while (m_tokenizer->nextToken(m_input, m_token)) {
+        bool end = m_token.type() == HTMLToken::EndTag;
+        if (end || m_token.type() == HTMLToken::StartTag) {
+            AtomicString tagName(m_token.name().data(), m_token.name().size());
+            if (!end) {
+                m_tokenizer->updateStateFor(tagName, 0);
+                if (tagName == metaTag && processMeta()) {
+                    m_doneChecking = true;
+                    return true;
+                }
+            }
+
+            if (tagName != scriptTag && tagName != noscriptTag
+                && tagName != styleTag && tagName != linkTag
+                && tagName != metaTag && tagName != objectTag
+                && tagName != titleTag && tagName != baseTag
+                && (end || tagName != htmlTag) && (end || tagName != headTag)) {
+                m_inHeadSection = false;
+            }
+        }
+
+        if (!m_inHeadSection && m_input.numberOfCharactersConsumed() >= bytesToCheckUnconditionally) {
+            m_doneChecking = true;
+            return true;
+        }
+
+        m_token.clear();
+    }
+
+    return false;
+}
+
+}
diff --git a/WebCore/html/parser/HTMLMetaCharsetParser.h b/WebCore/html/parser/HTMLMetaCharsetParser.h
new file mode 100644
index 0000000..c3136f5
--- /dev/null
+++ b/WebCore/html/parser/HTMLMetaCharsetParser.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2010 Google Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HTMLMetaCharsetParser_h
+#define HTMLMetaCharsetParser_h
+
+#include "HTMLToken.h"
+#include "SegmentedString.h"
+#include "TextEncoding.h"
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+class HTMLTokenizer;
+class TextCodec;
+
+class HTMLMetaCharsetParser : public Noncopyable {
+public:
+    static PassOwnPtr<HTMLMetaCharsetParser> create() { return adoptPtr(new HTMLMetaCharsetParser()); }
+
+    ~HTMLMetaCharsetParser();
+
+    // Returns true if done checking, regardless whether an encoding is found.
+    bool checkForMetaCharset(const char*, size_t);
+
+    const TextEncoding& encoding() { return m_encoding; }
+
+private:
+    HTMLMetaCharsetParser();
+
+    bool processMeta();
+    String extractCharset(const String&);
+
+    enum Mode {
+        None,
+        Charset,
+        Pragma,
+    };
+
+    OwnPtr<HTMLTokenizer> m_tokenizer;
+    OwnPtr<TextCodec> m_assumedCodec;
+    SegmentedString m_input;
+    HTMLToken m_token;
+    bool m_inHeadSection;
+
+    bool m_doneChecking;
+    TextEncoding m_encoding;
+};
+
+}
+#endif
diff --git a/WebCore/loader/TextResourceDecoder.cpp b/WebCore/loader/TextResourceDecoder.cpp
index 4002b38..c8198e3 100644
--- a/WebCore/loader/TextResourceDecoder.cpp
+++ b/WebCore/loader/TextResourceDecoder.cpp
@@ -24,6 +24,7 @@
 #include "TextResourceDecoder.h"
 
 #include "DOMImplementation.h"
+#include "HTMLMetaCharsetParser.h"
 #include "HTMLNames.h"
 #include "TextCodec.h"
 #include "TextEncoding.h"
@@ -61,29 +62,6 @@ static int find(const char* subject, size_t subjectLength, const char* target)
     return -1;
 }
 
-static int findIgnoringCase(const char* subject, size_t subjectLength, const char* target)
-{
-    size_t targetLength = strlen(target);
-    if (targetLength > subjectLength)
-        return -1;
-#ifndef NDEBUG
-    for (size_t i = 0; i < targetLength; ++i)
-        ASSERT(isASCIILower(target[i]));
-#endif
-    for (size_t i = 0; i <= subjectLength - targetLength; ++i) {
-        bool match = true;
-        for (size_t j = 0; j < targetLength; ++j) {
-            if (toASCIILower(subject[i + j]) != target[j]) {
-                match = false;
-                break;
-            }
-        }
-        if (match)
-            return i;
-    }
-    return -1;
-}
-
 static TextEncoding findTextEncoding(const char* encodingName, int length)
 {
     Vector<char, 64> buffer(length + 1);
@@ -534,8 +512,6 @@ static inline void skipComment(const char*& ptr, const char* pEnd)
     ptr = p;
 }
 
-const int bytesToCheckUnconditionally = 1024; // That many input bytes will be checked for meta charset even if <head> section is over.
-
 bool TextResourceDecoder::checkForHeadCharset(const char* data, size_t len, bool& movedDataToBuffer)
 {
     if (m_source != DefaultEncoding && m_source != EncodingFromParentFrame) {
@@ -552,6 +528,10 @@ bool TextResourceDecoder::checkForHeadCharset(const char* data, size_t len, bool
 
     movedDataToBuffer = true;
 
+    // Continue with checking for an HTML meta tag if we were already doing so.
+    if (m_charsetParser)
+        return checkForMetaCharset(data, len);
+
     const char* ptr = m_buffer.data();
     const char* pEnd = ptr + m_buffer.size();
 
@@ -587,163 +567,23 @@ bool TextResourceDecoder::checkForHeadCharset(const char* data, size_t len, bool
         return true;
     }
 
-    // we still don't have an encoding, and are in the head
-    // the following tags are allowed in <head>:
-    // SCRIPT|STYLE|META|LINK|OBJECT|TITLE|BASE
-    
-    // We stop scanning when a tag that is not permitted in <head>
-    // is seen, rather when </head> is seen, because that more closely
-    // matches behavior in other browsers; more details in
-    // <http://bugs.webkit.org/show_bug.cgi?id=3590>.
-    
-    // Additionally, we ignore things that looks like tags in <title>, <script> and <noscript>; see
-    // <http://bugs.webkit.org/show_bug.cgi?id=4560>, <http://bugs.webkit.org/show_bug.cgi?id=12165>
-    // and <http://bugs.webkit.org/show_bug.cgi?id=12389>.
-
-    // Since many sites have charset declarations after <body> or other tags that are disallowed in <head>,
-    // we don't bail out until we've checked at least bytesToCheckUnconditionally bytes of input.
-
-    AtomicStringImpl* enclosingTagName = 0;
-    bool inHeadSection = true; // Becomes false when </head> or any tag not allowed in head is encountered.
-
-    // the HTTP-EQUIV meta has no effect on XHTML
+    // The HTTP-EQUIV meta has no effect on XHTML.
     if (m_contentType == XML)
         return true;
 
-    while (ptr + 3 < pEnd) { // +3 guarantees that "<!--" fits in the buffer - and certainly we aren't going to lose any "charset" that way.
-        if (*ptr == '<') {
-            bool end = false;
-            ptr++;
-
-            // Handle comments.
-            if (ptr[0] == '!' && ptr[1] == '-' && ptr[2] == '-') {
-                ptr += 3;
-                skipComment(ptr, pEnd);
-                if (ptr - m_buffer.data() >= bytesToCheckUnconditionally && !inHeadSection) {
-                    // Some pages that test bandwidth from within the browser do it by having
-                    // huge comments and measuring the time they take to load. Repeatedly scanning
-                    // these comments can take a lot of CPU time.
-                    m_checkedForHeadCharset = true;
-                    return true;
-                }
-                continue;
-            }
-
-            if (*ptr == '/') {
-                ++ptr;
-                end = true;
-            }
+    m_charsetParser = HTMLMetaCharsetParser::create();
+    return checkForMetaCharset(data, len);
+}
 
-            // Grab the tag name, but mostly ignore namespaces.
-            bool sawNamespace = false;
-            char tagBuffer[20];
-            int len = 0;
-            while (len < 19) {
-                if (ptr == pEnd)
-                    return false;
-                char c = *ptr;
-                if (c == ':') {
-                    len = 0;
-                    sawNamespace = true;
-                    ptr++;
-                    continue;
-                }
-                if ((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9'))
-                    ;
-                else if (c >= 'A' && c <= 'Z')
-                    c += 'a' - 'A';
-                else
-                    break;
-                tagBuffer[len++] = c;
-                ptr++;
-            }
-            tagBuffer[len] = 0;
-            AtomicString tag(tagBuffer);
-            
-            if (enclosingTagName) {
-                if (end && tag.impl() == enclosingTagName)
-                    enclosingTagName = 0;
-            } else {
-                if (tag == titleTag)
-                    enclosingTagName = titleTag.localName().impl();
-                else if (tag == scriptTag)
-                    enclosingTagName = scriptTag.localName().impl();
-                else if (tag == noscriptTag)
-                    enclosingTagName = noscriptTag.localName().impl();
-            }
-            
-            // Find where the opening tag ends.
-            const char* tagContentStart = ptr;
-            if (!end) {
-                while (ptr != pEnd && *ptr != '>') {
-                    if (*ptr == '\'' || *ptr == '"') {
-                        char quoteMark = *ptr;
-                        ++ptr;
-                        while (ptr != pEnd && *ptr != quoteMark)
-                            ++ptr;
-                        if (ptr == pEnd)
-                            return false;
-                    }
-                    ++ptr;
-                }
-                if (ptr == pEnd)
-                    return false;
-                ++ptr;
-            }
-            
-            if (!end && tag == metaTag && !sawNamespace) {
-                const char* str = tagContentStart;
-                int length = ptr - tagContentStart;
-                int pos = 0;
-                while (pos < length) {
-                    int charsetPos = findIgnoringCase(str + pos, length - pos, "charset");
-                    if (charsetPos == -1)
-                        break;
-                    pos += charsetPos + 7;
-                    // skip whitespace
-                    while (pos < length && str[pos] <= ' ')
-                        pos++;
-                    if (pos == length)
-                        break;
-                    if (str[pos++] != '=')
-                        continue;
-                    while ((pos < length) &&
-                            (str[pos] <= ' ' || str[pos] == '=' || str[pos] == '"' || str[pos] == '\''))
-                        pos++;
-
-                    // end ?
-                    if (pos == length)
-                        break;
-                    int end = pos;
-                    while (end < length &&
-                           str[end] != ' ' && str[end] != '"' && str[end] != '\'' &&
-                           str[end] != ';' && str[end] != '>')
-                        end++;
-                    setEncoding(findTextEncoding(str + pos, end - pos), EncodingFromMetaTag);
-                    if (m_source == EncodingFromMetaTag)
-                        return true;
-
-                    if (end >= length || str[end] == '/' || str[end] == '>')
-                        break;
-
-                    pos = end + 1;
-                }
-            } else {
-                if (!enclosingTagName && tag != scriptTag && tag != noscriptTag && tag != styleTag
-                    && tag != linkTag && tag != metaTag && tag != objectTag && tag != titleTag && tag != baseTag
-                    && (end || tag != htmlTag) && (end || tag != headTag) && isASCIIAlpha(tagBuffer[0])) {
-                    inHeadSection = false;
-                }
+bool TextResourceDecoder::checkForMetaCharset(const char* data, size_t length)
+{
+    if (!m_charsetParser->checkForMetaCharset(data, length))
+        return false;
 
-                if (ptr - m_buffer.data() >= bytesToCheckUnconditionally && !inHeadSection) {
-                    m_checkedForHeadCharset = true;
-                    return true;
-                }
-            }
-        } else
-            ++ptr;
-    }
-    return false;
+    setEncoding(m_charsetParser->encoding(), EncodingFromMetaTag);
+    m_charsetParser.clear();
+    m_checkedForHeadCharset = true;
+    return true;
 }
 
 void TextResourceDecoder::detectJapaneseEncoding(const char* data, size_t len)
diff --git a/WebCore/loader/TextResourceDecoder.h b/WebCore/loader/TextResourceDecoder.h
index fb755c9..0bb855b 100644
--- a/WebCore/loader/TextResourceDecoder.h
+++ b/WebCore/loader/TextResourceDecoder.h
@@ -27,6 +27,8 @@
 
 namespace WebCore {
 
+class HTMLMetaCharsetParser;
+
 class TextResourceDecoder : public RefCounted<TextResourceDecoder> {
 public:
     enum EncodingSource {
@@ -74,6 +76,7 @@ private:
     size_t checkForBOM(const char*, size_t);
     bool checkForCSSCharset(const char*, size_t, bool& movedDataToBuffer);
     bool checkForHeadCharset(const char*, size_t, bool& movedDataToBuffer);
+    bool checkForMetaCharset(const char*, size_t);
     void detectJapaneseEncoding(const char*, size_t);
     bool shouldAutoDetect() const;
 
@@ -89,6 +92,8 @@ private:
     bool m_useLenientXMLDecoding; // Don't stop on XML decoding errors.
     bool m_sawError;
     bool m_usesEncodingDetector;
+
+    OwnPtr<HTMLMetaCharsetParser> m_charsetParser;
 };
 
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list