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 |