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

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

Issue 23601010: Make UTF-8 encoding of unpaired surrogates match Encoding standard (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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: Source/wtf/text/TextCodecUTF8.cpp
diff --git a/Source/wtf/text/TextCodecUTF8.cpp b/Source/wtf/text/TextCodecUTF8.cpp
index ce595b34619709488d0e20aa31b955afaeeb08f3..f26f3031c9620dfdbacef299834cab27e0dd7ab5 100644
--- a/Source/wtf/text/TextCodecUTF8.cpp
+++ b/Source/wtf/text/TextCodecUTF8.cpp
@@ -436,6 +436,8 @@ CString TextCodecUTF8::encodeCommon(const CharType* characters, size_t length)
while (i < length) {
UChar32 character;
U16_NEXT(characters, i, length, character);
+ if (0xD800 <= character && character <= 0xDFFF)
+ character = 0xFFFD;
jungshik at Google 2013/08/30 00:39:27 For a future code archaeologist, could you add a c
jsbell 2013/08/30 00:43:56 Will do. I'll also use WTF::Unicode::replacementCh
U8_APPEND_UNSAFE(bytes.data(), bytesWritten, character);
}

Powered by Google App Engine
This is Rietveld 408576698