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

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

Issue 1366433005: Remove dedicated TextCodecUTF16 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 3 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 | « third_party/WebKit/Source/wtf/BUILD.gn ('k') | third_party/WebKit/Source/wtf/text/TextCodecUTF16.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/text/TextCodecICU.cpp
diff --git a/third_party/WebKit/Source/wtf/text/TextCodecICU.cpp b/third_party/WebKit/Source/wtf/text/TextCodecICU.cpp
index d45faca45ec472cfe01fc50d0bea1c2bc9d476ff..c213bef623b8660de64a4a94a21fbda345d5cba6 100644
--- a/third_party/WebKit/Source/wtf/text/TextCodecICU.cpp
+++ b/third_party/WebKit/Source/wtf/text/TextCodecICU.cpp
@@ -220,6 +220,15 @@ void TextCodecICU::registerEncodingNames(EncodingNameRegistrar registrar)
registrar("x-cp1257", "windows-1257");
registrar("x-cp1258", "windows-1258");
#endif
+
+ // TODO(jshin): Move to ICU's data/mappings/convrtrs.txt aliases.
+ registrar("UTF-16", "utf-16le");
+ registrar("ISO-10646-UCS-2", "utf-16le");
+ registrar("UCS-2", "utf-16le");
+ registrar("Unicode", "utf-16le");
+ registrar("csUnicode", "utf-16le");
+ registrar("unicodeFEFF", "utf-16le");
+ registrar("unicodeFFFE", "utf-16be");
}
void TextCodecICU::registerCodecs(TextCodecRegistrar registrar)
@@ -544,7 +553,8 @@ CString TextCodecICU::encodeInternal(const TextCodecInput& input, UnencodableHan
switch (handling) {
case QuestionMarksForUnencodables:
- ucnv_setSubstChars(m_converterICU, "?", 1, &err);
+ if (!m_encoding.isNonByteBasedEncoding())
+ ucnv_setSubstChars(m_converterICU, "?", 1, &err);
#if !defined(USING_SYSTEM_ICU)
ucnv_setFromUCallBack(m_converterICU, UCNV_FROM_U_CALLBACK_SUBSTITUTE, 0, 0, 0, &err);
#else
« no previous file with comments | « third_party/WebKit/Source/wtf/BUILD.gn ('k') | third_party/WebKit/Source/wtf/text/TextCodecUTF16.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698