src/json.c

changeset 1160
4f02c1101f2e
parent 1159
48279dbe4811
equal deleted inserted replaced
1159:48279dbe4811 1160:4f02c1101f2e
403 utf8len = codepoint_to_utf8(codepoint, utf8buf); 403 utf8len = codepoint_to_utf8(codepoint, utf8buf);
404 } else if (utf16a >= 0xD800 && utf16a <= 0xDBFF) { 404 } else if (utf16a >= 0xD800 && utf16a <= 0xDBFF) {
405 // character is encoded as a surrogate pair 405 // character is encoded as a surrogate pair
406 // get next 6 bytes 406 // get next 6 bytes
407 if (str.length >= 12) { 407 if (str.length >= 12) {
408 if (*(str.ptr+6) == '\\' && *(str.ptr+7) == 'u') { 408 if (str.ptr[6] == '\\' && str.ptr[7] == 'u') {
409 cxstring ustr2 = { str.ptr+8, 4 }; 409 cxstring ustr2 = { str.ptr+8, 4 };
410 if (!cx_strtou16_lc(ustr2, &utf16b, 16, "") 410 if (!cx_strtou16_lc(ustr2, &utf16b, 16, "")
411 && utf16b >= 0xDC00 && utf16b <= 0xDFFF) { 411 && utf16b >= 0xDC00 && utf16b <= 0xDFFF) {
412 codepoint = utf16pair_to_codepoint(utf16a, utf16b); 412 codepoint = utf16pair_to_codepoint(utf16a, utf16b);
413 utf8len = codepoint_to_utf8(codepoint, utf8buf); 413 utf8len = codepoint_to_utf8(codepoint, utf8buf);

mercurial