From 63ab03ca28d13763f7e05dedf3eca90cbf052a64 Mon Sep 17 00:00:00 2001 From: Christopher Dunn Date: Wed, 20 Dec 2017 14:43:55 -0600 Subject: [PATCH] replace code point in range(0xD800, 0xDFFF) to replacement mark (#714) closes #712 --- src/lib_json/json_writer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp index de26b24..5ffaa15 100644 --- a/src/lib_json/json_writer.cpp +++ b/src/lib_json/json_writer.cpp @@ -199,7 +199,7 @@ static unsigned int utf8ToCodepoint(const char*& s, const char* e) { s += 2; // surrogates aren't valid codepoints itself // shouldn't be UTF-8 encoded - if (calculated >= 0xD800 && calculated >= 0xDFFF) + if (calculated >= 0xD800 && calculated <= 0xDFFF) return REPLACEMENT_CHARACTER; // oversized encoded characters are invalid return calculated < 0x800 ? REPLACEMENT_CHARACTER : calculated;