mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-10 03:50:38 +03:00
Added support for bigger codepoints in xs_utf8_enc().
This commit is contained in:
parent
b97f4c7a90
commit
0b69c9abe1
@ -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 >> 6) & 0x3f);
|
||||||
tmp[n++] = 0x80 | (cpoint & 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);
|
return xs_append_m(str, (char *)tmp, n);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user