summaryrefslogtreecommitdiffstats
path: root/utf8.c
diff options
context:
space:
mode:
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/utf8.c b/utf8.c
index 00b1c736..b276d872 100644
--- a/utf8.c
+++ b/utf8.c
@@ -318,6 +318,19 @@ utf8_combine(const struct utf8_data *utf8data)
return (value);
}
+/* Split a two-byte UTF-8 character. */
+u_int
+utf8_split2(u_int uc, u_char *ptr)
+{
+ if (uc > 0x7f) {
+ ptr[0] = (uc >> 6) | 0xc0;
+ ptr[1] = (uc & 0x3f) | 0x80;
+ return (2);
+ }
+ ptr[0] = uc;
+ return (1);
+}
+
/* Lookup width of UTF-8 data in tree. */
u_int
utf8_width(const struct utf8_data *utf8data)