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

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

Issue 999953003: Remove dedicated TextCodecUTF16 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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/modules/encoding/TextEncoder.cpp ('k') | Source/wtf/text/TextCodecUTF16.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 f24dda0aad8b3c5815412c9fa482637dead11346..c5f60346f3379bd86f13f558404a1564d4a0bc10 100644
--- a/Source/wtf/text/TextCodecICU.cpp
+++ b/Source/wtf/text/TextCodecICU.cpp
@@ -212,6 +212,16 @@ void TextCodecICU::registerEncodingNames(EncodingNameRegistrar registrar)
registrar("x-cp1256", "windows-1256");
registrar("x-cp1257", "windows-1257");
registrar("x-cp1258", "windows-1258");
+
+ // Standard labels for UTF-16.
+ registrar("UTF-16", "utf-16le");
+ // Non-standard labels for UTF-16.
+ 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)
@@ -487,7 +497,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);
ucnv_setFromUCallBack(m_converterICU, m_needsGBKFallbacks ? gbkCallbackSubstitute : UCNV_FROM_U_CALLBACK_SUBSTITUTE, 0, 0, 0, &err);
break;
case EntitiesForUnencodables:
« no previous file with comments | « Source/modules/encoding/TextEncoder.cpp ('k') | Source/wtf/text/TextCodecUTF16.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698