Title: [215711] trunk/Source/WebCore
Revision
215711
Author
cdu...@apple.com
Date
2017-04-24 18:44:32 -0700 (Mon, 24 Apr 2017)

Log Message

Regression(r204605): support for "cp874" charset alias was inadvertently dropped which may cause issues on certain Thai sites
https://bugs.webkit.org/show_bug.cgi?id=171128
<rdar://problem/31526844>

Reviewed by Alexey Proskuryakov.

When using Thai as default language on MacOS, defaultTextEncodingNameForSystemLanguage()
was returning "cp874" encoding with was dropped in r204605 for not being part of the
encoding specification (https://encoding.spec.whatwg.org/#names-and-labels).

To address the issue, we map "cp874" encoding to the "dos-874" encoding which is
properly recognized. Without this, this could lead to issue on WebSites that do not
specify a charset.

* platform/text/TextEncodingRegistry.cpp:
(WebCore::defaultTextEncodingNameForSystemLanguage):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (215710 => 215711)


--- trunk/Source/WebCore/ChangeLog	2017-04-25 01:23:55 UTC (rev 215710)
+++ trunk/Source/WebCore/ChangeLog	2017-04-25 01:44:32 UTC (rev 215711)
@@ -1,3 +1,22 @@
+2017-04-24  Chris Dumez  <cdu...@apple.com>
+
+        Regression(r204605): support for "cp874" charset alias was inadvertently dropped which may cause issues on certain Thai sites
+        https://bugs.webkit.org/show_bug.cgi?id=171128
+        <rdar://problem/31526844>
+
+        Reviewed by Alexey Proskuryakov.
+
+        When using Thai as default language on MacOS, defaultTextEncodingNameForSystemLanguage()
+        was returning "cp874" encoding with was dropped in r204605 for not being part of the
+        encoding specification (https://encoding.spec.whatwg.org/#names-and-labels).
+
+        To address the issue, we map "cp874" encoding to the "dos-874" encoding which is
+        properly recognized. Without this, this could lead to issue on WebSites that do not
+        specify a charset.
+
+        * platform/text/TextEncodingRegistry.cpp:
+        (WebCore::defaultTextEncodingNameForSystemLanguage):
+
 2017-04-24  Said Abou-Hallawa  <sabouhall...@apple.com>
 
         [CG] Provide a type identifier hint to the CGImageSource so getting the type identifier is more accurate

Modified: trunk/Source/WebCore/platform/text/TextEncodingRegistry.cpp (215710 => 215711)


--- trunk/Source/WebCore/platform/text/TextEncodingRegistry.cpp	2017-04-25 01:23:55 UTC (rev 215710)
+++ trunk/Source/WebCore/platform/text/TextEncodingRegistry.cpp	2017-04-25 01:44:32 UTC (rev 215711)
@@ -377,6 +377,13 @@
     // On some OS versions, the result is CP949 (uppercase).
     if (equalLettersIgnoringASCIICase(systemEncodingName, "cp949"))
         systemEncodingName = ASCIILiteral("ks_c_5601-1987");
+
+    // CFStringConvertEncodingToIANACharSetName() returns cp874 for kTextEncodingDOSThai, AKA windows-874.
+    // Since "cp874" alias is not standard (https://encoding.spec.whatwg.org/#names-and-labels), map to
+    // "dos-874" instead.
+    if (equalLettersIgnoringASCIICase(systemEncodingName, "cp874"))
+        systemEncodingName = ASCIILiteral("dos-874");
+
     return systemEncodingName;
 #else
     return ASCIILiteral("ISO-8859-1");
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to