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

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

Issue 2478653002: Don't initialize ICU replacement character for UTF-32 encodings (Closed)
Patch Set: Don't use zero-length array initializer, to keep MSVC happy Created 4 years, 1 month 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
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 196c1beba038697be35cf38cb38a3b80d71d9125..fba4b79a40a00bd06158a7739ef7e51d9cfec266 100644
--- a/third_party/WebKit/Source/wtf/text/TextCodecICU.cpp
+++ b/third_party/WebKit/Source/wtf/text/TextCodecICU.cpp
@@ -608,7 +608,11 @@ CString TextCodecICU::encodeInternal(const TextCodecInput& input,
switch (handling) {
case QuestionMarksForUnencodables:
- ucnv_setSubstChars(m_converterICU, "?", 1, &err);
+ // Non-byte-based encodings (i.e. UTF-16/32) don't need substitutions
+ // since they can encode any code point, and ucnv_setSubstChars would
+ // require a multi-byte substitution anyway.
+ 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);
« no previous file with comments | « third_party/WebKit/Source/wtf/text/TextCodecICU.h ('k') | third_party/WebKit/Source/wtf/text/TextCodecICUTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698