mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-21 21:05:05 +00:00
Added support for bigger codepoints in xs_utf8_enc().
This commit is contained in:
parent
b97f4c7a90
commit
0b69c9abe1
2 changed files with 7 additions and 1 deletions
|
@ -171,6 +171,13 @@ d_char *xs_utf8_enc(d_char *str, unsigned int cpoint)
|
|||
tmp[n++] = 0x80 | ((cpoint >> 6) & 0x3f);
|
||||
tmp[n++] = 0x80 | (cpoint & 0x3f);
|
||||
}
|
||||
else
|
||||
if (cpoint < 0x200000) {
|
||||
tmp[n++] = 0xf0 | (cpoint >> 18);
|
||||
tmp[n++] = 0x80 | ((cpoint >> 12) & 0x3f);
|
||||
tmp[n++] = 0x80 | ((cpoint >> 6) & 0x3f);
|
||||
tmp[n++] = 0x80 | (cpoint & 0x3f);
|
||||
}
|
||||
|
||||
return xs_append_m(str, (char *)tmp, n);
|
||||
}
|
||||
|
|
|
@ -244,7 +244,6 @@ d_char *_xs_json_loads_lexer(const char **json, js_type *t)
|
|||
s += 3;
|
||||
tmp[4] = '\0';
|
||||
|
||||
xs_debug();
|
||||
sscanf(tmp, "%04x", &i);
|
||||
|
||||
if (i >= 0xd800 && i <= 0xdfff) {
|
||||
|
|
Loading…
Reference in a new issue