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: |