replace code point in range(0xD800, 0xDFFF) to replacement mark (#714)

closes #712
This commit is contained in:
Christopher Dunn 2017-12-20 14:43:55 -06:00 committed by GitHub
parent 41ff85f443
commit 63ab03ca28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;