Improve compatibility with GBK #3598 (#3599)

This commit is contained in:
YuHuanTin 2023-08-19 23:13:20 +08:00 committed by GitHub
parent bbb784fb1b
commit bd868f3a51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1453,7 +1453,7 @@ template <typename WChar, typename Buffer = memory_buffer> class to_utf8 {
++p;
if (p == s.end() || (c & 0xfc00) != 0xd800 || (*p & 0xfc00) != 0xdc00) {
if (policy == to_utf8_error_policy::abort) return false;
buf.append(string_view("<EFBFBD>"));
buf.append(string_view("\xEF\xBF\xBD"));
--p;
} else {
c = (c << 10) + static_cast<uint32_t>(*p) - 0x35fdc00;