X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=utils%2Futf8wc.h;h=d91567c2c2e7746ebd2a5ec1ef3bab6a82a7d2b5;hp=563f77978555d2e7e2e684954a36d02496cbb2de;hb=d1ae2829ff0fd2a96c16a0c8c5420efaa47d7b30;hpb=7edd66e6bd3209013ee059819747b10b5835635b diff --git a/utils/utf8wc.h b/utils/utf8wc.h index 563f7797..d91567c2 100644 --- a/utils/utf8wc.h +++ b/utils/utf8wc.h @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 2014 Jamie Zawinski +/* xscreensaver, Copyright (c) 2014-2015 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -33,4 +33,15 @@ extern char ** utf8_split (const char *string, int *length_ret); */ extern char *utf8_to_latin1 (const char *string, Bool ascii_p); +/* Converts a Unicode character to a multi-byte UTF8 sequence. + Returns the number of bytes written. + */ +extern int utf8_encode (unsigned long uc, char *out, long length); + +/* Parse the first UTF8 character at the front of the string. + Return the Unicode character, and the number of bytes read. + */ +extern long utf8_decode (const unsigned char *in, long length, + unsigned long *unicode_ret); + #endif /* __XSCREENSAVER_UTF8WC_H__ */