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

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

Issue 2354533005: FormData should not drop ignorable code points. (Closed)
Patch Set: 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
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 3d1c0caa7f359d9db3319db0663b22ea51d40556..d45faca45ec472cfe01fc50d0bea1c2bc9d476ff 100644
--- a/third_party/WebKit/Source/wtf/text/TextCodecICU.cpp
+++ b/third_party/WebKit/Source/wtf/text/TextCodecICU.cpp
@@ -424,6 +424,12 @@ static void formatEscapedEntityCallback(const void* context, UConverterFromUnico
}
}
+static void numericEntityCallback(const void* context, UConverterFromUnicodeArgs* fromUArgs, const UChar* codeUnits, int32_t length,
+ UChar32 codePoint, UConverterCallbackReason reason, UErrorCode* err)
+{
+ formatEscapedEntityCallback(context, fromUArgs, codeUnits, length, codePoint, reason, err, EntitiesForUnencodables);
+}
+
// Invalid character handler when writing escaped entities in CSS encoding for
// unrepresentable characters. See the declaration of TextCodec::encode for more.
static void cssEscapedEntityCallback(const void* context, UConverterFromUnicodeArgs* fromUArgs, const UChar* codeUnits, int32_t length,
@@ -452,7 +458,7 @@ static void gbkCallbackEscape(const void* context, UConverterFromUnicodeArgs* fr
ucnv_cbFromUWriteUChars(fromUArgs, &source, source + 1, 0, err);
return;
}
- UCNV_FROM_U_CALLBACK_ESCAPE(context, fromUArgs, codeUnits, length, codePoint, reason, err);
+ numericEntityCallback(context, fromUArgs, codeUnits, length, codePoint, reason, err);
}
// Combines both gbkCssEscapedEntityCallback and GBK character substitution.
@@ -547,9 +553,9 @@ CString TextCodecICU::encodeInternal(const TextCodecInput& input, UnencodableHan
break;
case EntitiesForUnencodables:
#if !defined(USING_SYSTEM_ICU)
- ucnv_setFromUCallBack(m_converterICU, UCNV_FROM_U_CALLBACK_ESCAPE, UCNV_ESCAPE_XML_DEC, 0, 0, &err);
+ ucnv_setFromUCallBack(m_converterICU, numericEntityCallback, 0, 0, 0, &err);
#else
- ucnv_setFromUCallBack(m_converterICU, m_needsGBKFallbacks ? gbkCallbackEscape : UCNV_FROM_U_CALLBACK_ESCAPE, UCNV_ESCAPE_XML_DEC, 0, 0, &err);
+ ucnv_setFromUCallBack(m_converterICU, m_needsGBKFallbacks ? gbkCallbackEscape : numericEntityCallback, 0, 0, 0, &err);
#endif
break;
case URLEncodedEntitiesForUnencodables:
« 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