Reviewed by Darin.
authorap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Oct 2006 16:44:15 +0000 (16:44 +0000)
committerap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Oct 2006 16:44:15 +0000 (16:44 +0000)
        http://bugs.webkit.org/show_bug.cgi?id=11054
        REGRESSION: Traditional Chinese encoding in login authentication

        1. Treat GB2312 encoding as GBK (its more modern superset), to match other browsers.
        2. On the Web, GB2312 is encoded as EUC-CN or HZ, while ICU provides a native encoding
        for encoding GB_2312-80 and several others. So, we need to override this behavior, too.

WebCore:
        * platform/StreamingTextDecoderICU.cpp:
        (WebCore::TextCodecICU::registerEncodingNames):

LayoutTests:
        Each of these tests is passed by Firefox 1.5 and/or WinIE 6.

        * fast/encoding/GBK/EUC-CN-expected.txt: Added.
        * fast/encoding/GBK/EUC-CN.html: Added.
        * fast/encoding/GBK/chinese-expected.txt: Added.
        * fast/encoding/GBK/chinese.html: Added.
        * fast/encoding/GBK/cn-gb-expected.txt: Added.
        * fast/encoding/GBK/cn-gb.html: Added.
        * fast/encoding/GBK/csgb2312-expected.txt: Added.
        * fast/encoding/GBK/csgb2312.html: Added.
        * fast/encoding/GBK/csgb231280-expected.txt: Added.
        * fast/encoding/GBK/csgb231280.html: Added.
        * fast/encoding/GBK/gb2312-expected.txt: Added.
        * fast/encoding/GBK/gb2312.html: Added.
        * fast/encoding/GBK/gb_2312-80-expected.txt: Added.
        * fast/encoding/GBK/gb_2312-80.html: Added.
        * fast/encoding/GBK/gbk-expected.txt: Added.
        * fast/encoding/GBK/gbk.html: Added.
        * fast/encoding/GBK/iso-ir-58-expected.txt: Added.
        * fast/encoding/GBK/iso-ir-58.html: Added.
        * fast/encoding/GBK/x-euc-cn-expected.txt: Added.
        * fast/encoding/GBK/x-euc-cn.html: Added.
        * fast/encoding/GBK/x-gbk-expected.txt: Added.
        * fast/encoding/GBK/x-gbk.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16807 268f45cc-cd09-0410-ab3c-d52691b4dbfc

25 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/encoding/GBK/EUC-CN-expected.txt [new file with mode: 0644]
LayoutTests/fast/encoding/GBK/EUC-CN.html [new file with mode: 0644]
LayoutTests/fast/encoding/GBK/chinese-expected.txt [new file with mode: 0644]
LayoutTests/fast/encoding/GBK/chinese.html [new file with mode: 0644]
LayoutTests/fast/encoding/GBK/cn-gb-expected.txt [new file with mode: 0644]
LayoutTests/fast/encoding/GBK/cn-gb.html [new file with mode: 0644]
LayoutTests/fast/encoding/GBK/csgb2312-expected.txt [new file with mode: 0644]
LayoutTests/fast/encoding/GBK/csgb2312.html [new file with mode: 0644]
LayoutTests/fast/encoding/GBK/csgb231280-expected.txt [new file with mode: 0644]
LayoutTests/fast/encoding/GBK/csgb231280.html [new file with mode: 0644]
LayoutTests/fast/encoding/GBK/gb2312-expected.txt [new file with mode: 0644]
LayoutTests/fast/encoding/GBK/gb2312.html [new file with mode: 0644]
LayoutTests/fast/encoding/GBK/gb_2312-80-expected.txt [new file with mode: 0644]
LayoutTests/fast/encoding/GBK/gb_2312-80.html [new file with mode: 0644]
LayoutTests/fast/encoding/GBK/gbk-expected.txt [new file with mode: 0644]
LayoutTests/fast/encoding/GBK/gbk.html [new file with mode: 0644]
LayoutTests/fast/encoding/GBK/iso-ir-58-expected.txt [new file with mode: 0644]
LayoutTests/fast/encoding/GBK/iso-ir-58.html [new file with mode: 0644]
LayoutTests/fast/encoding/GBK/x-euc-cn-expected.txt [new file with mode: 0644]
LayoutTests/fast/encoding/GBK/x-euc-cn.html [new file with mode: 0644]
LayoutTests/fast/encoding/GBK/x-gbk-expected.txt [new file with mode: 0644]
LayoutTests/fast/encoding/GBK/x-gbk.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/platform/StreamingTextDecoderICU.cpp

index b6673a886d448cbe7913ea5c16b5630d23906c3f..b2547de5a29968f3b8f93794f2c1a961d574e497 100644 (file)
@@ -1,3 +1,35 @@
+2006-10-05  Alexey Proskuryakov  <ap@nypop.com>
+
+        Reviewed by Darin.
+
+        http://bugs.webkit.org/show_bug.cgi?id=11054
+        REGRESSION: Traditional Chinese encoding in login authentication
+
+        Each of these tests is passed by Firefox 1.5 and/or WinIE 6.
+
+        * fast/encoding/GBK/EUC-CN-expected.txt: Added.
+        * fast/encoding/GBK/EUC-CN.html: Added.
+        * fast/encoding/GBK/chinese-expected.txt: Added.
+        * fast/encoding/GBK/chinese.html: Added.
+        * fast/encoding/GBK/cn-gb-expected.txt: Added.
+        * fast/encoding/GBK/cn-gb.html: Added.
+        * fast/encoding/GBK/csgb2312-expected.txt: Added.
+        * fast/encoding/GBK/csgb2312.html: Added.
+        * fast/encoding/GBK/csgb231280-expected.txt: Added.
+        * fast/encoding/GBK/csgb231280.html: Added.
+        * fast/encoding/GBK/gb2312-expected.txt: Added.
+        * fast/encoding/GBK/gb2312.html: Added.
+        * fast/encoding/GBK/gb_2312-80-expected.txt: Added.
+        * fast/encoding/GBK/gb_2312-80.html: Added.
+        * fast/encoding/GBK/gbk-expected.txt: Added.
+        * fast/encoding/GBK/gbk.html: Added.
+        * fast/encoding/GBK/iso-ir-58-expected.txt: Added.
+        * fast/encoding/GBK/iso-ir-58.html: Added.
+        * fast/encoding/GBK/x-euc-cn-expected.txt: Added.
+        * fast/encoding/GBK/x-euc-cn.html: Added.
+        * fast/encoding/GBK/x-gbk-expected.txt: Added.
+        * fast/encoding/GBK/x-gbk.html: Added.
+
 2006-10-04  Anders Carlsson  <acarlsson@apple.com>
 
         Reviewed by Adam.
diff --git a/LayoutTests/fast/encoding/GBK/EUC-CN-expected.txt b/LayoutTests/fast/encoding/GBK/EUC-CN-expected.txt
new file mode 100644 (file)
index 0000000..4427e00
--- /dev/null
@@ -0,0 +1,7 @@
+The following two lines should look identically:
+
+一筆€镕
+
+一筆€镕
+
+
diff --git a/LayoutTests/fast/encoding/GBK/EUC-CN.html b/LayoutTests/fast/encoding/GBK/EUC-CN.html
new file mode 100644 (file)
index 0000000..cb8f53f
--- /dev/null
@@ -0,0 +1,10 @@
+<head>
+    <meta content="text/html; charset=EUC-CN" http-equiv="Content-Type"/>
+</head>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+<p>The following two lines should look identically:</p>
+<p>Ò»¹P\80éF</p>
+<p>&#19968;&#31558;&euro;&#38229;</p>
diff --git a/LayoutTests/fast/encoding/GBK/chinese-expected.txt b/LayoutTests/fast/encoding/GBK/chinese-expected.txt
new file mode 100644 (file)
index 0000000..4427e00
--- /dev/null
@@ -0,0 +1,7 @@
+The following two lines should look identically:
+
+一筆€镕
+
+一筆€镕
+
+
diff --git a/LayoutTests/fast/encoding/GBK/chinese.html b/LayoutTests/fast/encoding/GBK/chinese.html
new file mode 100644 (file)
index 0000000..a6a4c08
--- /dev/null
@@ -0,0 +1,10 @@
+<head>
+    <meta content="text/html; charset=chinese" http-equiv="Content-Type"/>
+</head>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+<p>The following two lines should look identically:</p>
+<p>Ò»¹P\80éF</p>
+<p>&#19968;&#31558;&euro;&#38229;</p>
diff --git a/LayoutTests/fast/encoding/GBK/cn-gb-expected.txt b/LayoutTests/fast/encoding/GBK/cn-gb-expected.txt
new file mode 100644 (file)
index 0000000..4427e00
--- /dev/null
@@ -0,0 +1,7 @@
+The following two lines should look identically:
+
+一筆€镕
+
+一筆€镕
+
+
diff --git a/LayoutTests/fast/encoding/GBK/cn-gb.html b/LayoutTests/fast/encoding/GBK/cn-gb.html
new file mode 100644 (file)
index 0000000..99b11ff
--- /dev/null
@@ -0,0 +1,10 @@
+<head>
+    <meta content="text/html; charset=cn-gb" http-equiv="Content-Type"/>
+</head>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+<p>The following two lines should look identically:</p>
+<p>Ò»¹P\80éF</p>
+<p>&#19968;&#31558;&euro;&#38229;</p>
diff --git a/LayoutTests/fast/encoding/GBK/csgb2312-expected.txt b/LayoutTests/fast/encoding/GBK/csgb2312-expected.txt
new file mode 100644 (file)
index 0000000..4427e00
--- /dev/null
@@ -0,0 +1,7 @@
+The following two lines should look identically:
+
+一筆€镕
+
+一筆€镕
+
+
diff --git a/LayoutTests/fast/encoding/GBK/csgb2312.html b/LayoutTests/fast/encoding/GBK/csgb2312.html
new file mode 100644 (file)
index 0000000..f7afd45
--- /dev/null
@@ -0,0 +1,10 @@
+<head>
+    <meta content="text/html; charset=csgb2312" http-equiv="Content-Type"/>
+</head>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+<p>The following two lines should look identically:</p>
+<p>Ò»¹P\80éF</p>
+<p>&#19968;&#31558;&euro;&#38229;</p>
diff --git a/LayoutTests/fast/encoding/GBK/csgb231280-expected.txt b/LayoutTests/fast/encoding/GBK/csgb231280-expected.txt
new file mode 100644 (file)
index 0000000..4427e00
--- /dev/null
@@ -0,0 +1,7 @@
+The following two lines should look identically:
+
+一筆€镕
+
+一筆€镕
+
+
diff --git a/LayoutTests/fast/encoding/GBK/csgb231280.html b/LayoutTests/fast/encoding/GBK/csgb231280.html
new file mode 100644 (file)
index 0000000..033d8ef
--- /dev/null
@@ -0,0 +1,10 @@
+<head>
+    <meta content="text/html; charset=csgb231280" http-equiv="Content-Type"/>
+</head>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+<p>The following two lines should look identically:</p>
+<p>Ò»¹P\80éF</p>
+<p>&#19968;&#31558;&euro;&#38229;</p>
diff --git a/LayoutTests/fast/encoding/GBK/gb2312-expected.txt b/LayoutTests/fast/encoding/GBK/gb2312-expected.txt
new file mode 100644 (file)
index 0000000..4427e00
--- /dev/null
@@ -0,0 +1,7 @@
+The following two lines should look identically:
+
+一筆€镕
+
+一筆€镕
+
+
diff --git a/LayoutTests/fast/encoding/GBK/gb2312.html b/LayoutTests/fast/encoding/GBK/gb2312.html
new file mode 100644 (file)
index 0000000..72e69ea
--- /dev/null
@@ -0,0 +1,10 @@
+<head>
+    <meta content="text/html; charset=gb2312" http-equiv="Content-Type"/>
+</head>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+<p>The following two lines should look identically:</p>
+<p>Ò»¹P\80éF</p>
+<p>&#19968;&#31558;&euro;&#38229;</p>
diff --git a/LayoutTests/fast/encoding/GBK/gb_2312-80-expected.txt b/LayoutTests/fast/encoding/GBK/gb_2312-80-expected.txt
new file mode 100644 (file)
index 0000000..4427e00
--- /dev/null
@@ -0,0 +1,7 @@
+The following two lines should look identically:
+
+一筆€镕
+
+一筆€镕
+
+
diff --git a/LayoutTests/fast/encoding/GBK/gb_2312-80.html b/LayoutTests/fast/encoding/GBK/gb_2312-80.html
new file mode 100644 (file)
index 0000000..e16695e
--- /dev/null
@@ -0,0 +1,10 @@
+<head>
+    <meta content="text/html; charset=gb_2312-80" http-equiv="Content-Type"/>
+</head>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+<p>The following two lines should look identically:</p>
+<p>Ò»¹P\80éF</p>
+<p>&#19968;&#31558;&euro;&#38229;</p>
diff --git a/LayoutTests/fast/encoding/GBK/gbk-expected.txt b/LayoutTests/fast/encoding/GBK/gbk-expected.txt
new file mode 100644 (file)
index 0000000..4427e00
--- /dev/null
@@ -0,0 +1,7 @@
+The following two lines should look identically:
+
+一筆€镕
+
+一筆€镕
+
+
diff --git a/LayoutTests/fast/encoding/GBK/gbk.html b/LayoutTests/fast/encoding/GBK/gbk.html
new file mode 100644 (file)
index 0000000..6632595
--- /dev/null
@@ -0,0 +1,10 @@
+<head>
+    <meta content="text/html; charset=gbk" http-equiv="Content-Type"/>
+</head>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+<p>The following two lines should look identically:</p>
+<p>Ò»¹P\80éF</p>
+<p>&#19968;&#31558;&euro;&#38229;</p>
diff --git a/LayoutTests/fast/encoding/GBK/iso-ir-58-expected.txt b/LayoutTests/fast/encoding/GBK/iso-ir-58-expected.txt
new file mode 100644 (file)
index 0000000..4427e00
--- /dev/null
@@ -0,0 +1,7 @@
+The following two lines should look identically:
+
+一筆€镕
+
+一筆€镕
+
+
diff --git a/LayoutTests/fast/encoding/GBK/iso-ir-58.html b/LayoutTests/fast/encoding/GBK/iso-ir-58.html
new file mode 100644 (file)
index 0000000..7fa90bc
--- /dev/null
@@ -0,0 +1,10 @@
+<head>
+    <meta content="text/html; charset=iso-ir-58" http-equiv="Content-Type"/>
+</head>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+<p>The following two lines should look identically:</p>
+<p>Ò»¹P\80éF</p>
+<p>&#19968;&#31558;&euro;&#38229;</p>
diff --git a/LayoutTests/fast/encoding/GBK/x-euc-cn-expected.txt b/LayoutTests/fast/encoding/GBK/x-euc-cn-expected.txt
new file mode 100644 (file)
index 0000000..4427e00
--- /dev/null
@@ -0,0 +1,7 @@
+The following two lines should look identically:
+
+一筆€镕
+
+一筆€镕
+
+
diff --git a/LayoutTests/fast/encoding/GBK/x-euc-cn.html b/LayoutTests/fast/encoding/GBK/x-euc-cn.html
new file mode 100644 (file)
index 0000000..4311d05
--- /dev/null
@@ -0,0 +1,10 @@
+<head>
+    <meta content="text/html; charset=x-euc-cn" http-equiv="Content-Type"/>
+</head>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+<p>The following two lines should look identically:</p>
+<p>Ò»¹P\80éF</p>
+<p>&#19968;&#31558;&euro;&#38229;</p>
diff --git a/LayoutTests/fast/encoding/GBK/x-gbk-expected.txt b/LayoutTests/fast/encoding/GBK/x-gbk-expected.txt
new file mode 100644 (file)
index 0000000..4427e00
--- /dev/null
@@ -0,0 +1,7 @@
+The following two lines should look identically:
+
+一筆€镕
+
+一筆€镕
+
+
diff --git a/LayoutTests/fast/encoding/GBK/x-gbk.html b/LayoutTests/fast/encoding/GBK/x-gbk.html
new file mode 100644 (file)
index 0000000..04aa636
--- /dev/null
@@ -0,0 +1,10 @@
+<head>
+    <meta content="text/html; charset=x-gbk" http-equiv="Content-Type"/>
+</head>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+<p>The following two lines should look identically:</p>
+<p>Ò»¹P\80éF</p>
+<p>&#19968;&#31558;&euro;&#38229;</p>
index a627685dfb82b5c74aec3a0283c2dfa3fe19cc31..022aa685b53f8f538dadb363b4662ba227bba785 100644 (file)
@@ -1,3 +1,17 @@
+2006-10-05  Alexey Proskuryakov  <ap@nypop.com>
+
+        Reviewed by Darin.
+
+        http://bugs.webkit.org/show_bug.cgi?id=11054
+        REGRESSION: Traditional Chinese encoding in login authentication
+
+        1. Treat GB2312 encoding as GBK (its more modern superset), to match other browsers.
+        2. On the Web, GB2312 is encoded as EUC-CN or HZ, while ICU provides a native encoding
+        for encoding GB_2312-80 and several others. So, we need to override this behavior, too.
+
+        * platform/StreamingTextDecoderICU.cpp:
+        (WebCore::TextCodecICU::registerEncodingNames):
+
 2006-10-05  Eric Seidel  <eric@eseidel.com>
 
         Reviewed by mjs.
index ea896f8e53ccb2ca1337282f52a2d1712abccef6..6f4e37beeb75e936ead0918abd27353c81400460 100644 (file)
@@ -63,7 +63,13 @@ void TextCodecICU::registerEncodingNames(EncodingNameRegistrar registrar)
         if (!U_SUCCESS(error) || !standardName)
             continue;
 
-        registrar(standardName, standardName);
+        // 1. Treat GB2312 encoding as GBK (its more modern superset), to match other browsers.
+        // 2. On the Web, GB2312 is encoded as EUC-CN or HZ, while ICU provides a native encoding
+        //    for encoding GB_2312-80 and several others. So, we need to override this behavior, too.
+        if (strcmp(standardName, "GB2312") == 0 || strcmp(standardName, "GB_2312-80") == 0)
+            standardName = "GBK";
+        else
+            registrar(standardName, standardName);
 
         uint16_t numAliases = ucnv_countAliases(name, &error);
         ASSERT(U_SUCCESS(error));