mirror of
https://github.com/typeable/aeson.git
synced 2024-10-03 20:57:41 +03:00
Fixed "Invalid UTF-8 stream" error on valid characters (#476).
This commit is contained in:
parent
d9f0374a75
commit
8049b358ee
@ -130,7 +130,7 @@ int _js_decode_string(uint16_t *const dest, size_t *destoff,
|
||||
*d++ = (uint16_t) unidata;
|
||||
|
||||
if (surrogate) {
|
||||
if (unidata <= 0xDC00 || unidata >= 0xDFFF) // is not low surrogate
|
||||
if (unidata < 0xDC00 || unidata > 0xDFFF) // is not low surrogate
|
||||
return -1;
|
||||
surrogate = 0;
|
||||
} else if (unidata >= 0xD800 && unidata <= 0xDBFF ) { // is high surrogate
|
||||
@ -147,4 +147,3 @@ int _js_decode_string(uint16_t *const dest, size_t *destoff,
|
||||
if (codepoint != 'u') { return -1; }
|
||||
DISPATCH_ASCII(unicode1)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user