Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1220)

Unified Diff: Source/wtf/text/TextCodecICU.cpp

Issue 25870005: Canonical name change: windows-949 => EUC-KR (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: update legacy-encode result and cl description Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/inspector/InspectorFileSystemAgent.cpp ('k') | Source/wtf/text/TextEncoding.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/text/TextCodecICU.cpp
diff --git a/Source/wtf/text/TextCodecICU.cpp b/Source/wtf/text/TextCodecICU.cpp
index 2ede9bf9b8dff42b07b8ec3faf91e58a240262ff..7458c2acf09a34405c51ed3086124e9717d0f976 100644
--- a/Source/wtf/text/TextCodecICU.cpp
+++ b/Source/wtf/text/TextCodecICU.cpp
@@ -84,18 +84,22 @@ void TextCodecICU::registerEncodingNames(EncodingNameRegistrar registrar)
continue;
}
+ // A number of these aliases are handled in Chrome's copy of ICU, but
+ // Chromium can be compiled with the system ICU.
+
// 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)
+ if (!strcmp(standardName, "GB2312") || !strcmp(standardName, "GB_2312-80"))
standardName = "GBK";
- // Similarly, EUC-KR encodings all map to an extended version.
- else if (strcmp(standardName, "KSC_5601") == 0 || strcmp(standardName, "EUC-KR") == 0 || strcmp(standardName, "cp1363") == 0)
- standardName = "windows-949";
+ // Similarly, EUC-KR encodings all map to an extended version, but
+ // per HTML5, the canonical name still should be EUC-KR.
+ else if (!strcmp(standardName, "EUC-KR") || !strcmp(standardName, "KSC_5601") || !strcmp(standardName, "cp1363"))
+ standardName = "EUC-KR";
// And so on.
- else if (strcasecmp(standardName, "iso-8859-9") == 0) // This name is returned in different case by ICU 3.2 and 3.6.
+ else if (!strcasecmp(standardName, "iso-8859-9")) // This name is returned in different case by ICU 3.2 and 3.6.
standardName = "windows-1254";
- else if (strcmp(standardName, "TIS-620") == 0)
+ else if (!strcmp(standardName, "TIS-620"))
standardName = "windows-874";
registrar(standardName, standardName);
@@ -147,9 +151,9 @@ void TextCodecICU::registerEncodingNames(EncodingNameRegistrar registrar)
registrar("x-cp1250", "windows-1250");
registrar("x-cp1251", "windows-1251");
registrar("x-euc", "EUC-JP");
- registrar("x-windows-949", "windows-949");
- registrar("KSC5601", "KSC_5601");
- registrar("x-uhc", "windows-949");
+ registrar("x-windows-949", "EUC-KR");
+ registrar("KSC5601", "EUC-KR");
+ registrar("x-uhc", "EUC-KR");
registrar("shift-jis", "Shift_JIS");
// These aliases are present in modern versions of ICU, but use different codecs, and have no standard names.
@@ -333,7 +337,7 @@ String TextCodecICU::decode(const char* bytes, size_t length, bool flush, bool s
// <http://bugs.webkit.org/show_bug.cgi?id=17014>
// Simplified Chinese pages use the code A3A0 to mean "full-width space", but ICU decodes it as U+E5E5.
- if (strcmp(m_encoding.name(), "GBK") == 0 || strcasecmp(m_encoding.name(), "gb18030") == 0)
+ if (!strcmp(m_encoding.name(), "GBK") || !strcasecmp(m_encoding.name(), "gb18030"))
resultString.replace(0xE5E5, ideographicSpace);
return resultString;
« no previous file with comments | « Source/core/inspector/InspectorFileSystemAgent.cpp ('k') | Source/wtf/text/TextEncoding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698