1 /* xscreensaver, Copyright (c) 2014 Jamie Zawinski <jwz@jwz.org>
3 * Permission to use, copy, modify, distribute, and sell this software and its
4 * documentation for any purpose is hereby granted without fee, provided that
5 * the above copyright notice appear in all copies and that both that
6 * copyright notice and this permission notice appear in supporting
7 * documentation. No representations are made about the suitability of this
8 * software for any purpose. It is provided "as is" without express or
12 #ifndef __XSCREENSAVER_UTF8WC_H__
13 #define __XSCREENSAVER_UTF8WC_H__
15 /* Utilities for converting between UTF8 and XChar2b. */
17 /* Converts a null-terminated UTF8 string to a null-terminated XChar2b array.
18 This only handles characters that can be represented in 16 bits, the
19 Basic Multilingual Plane. (No hieroglyphics, Elvish, Klingon or Emoji.)
21 extern XChar2b * utf8_to_XChar2b (const char *, int *length_ret);
23 /* Converts a null-terminated XChar2b array to a null-terminated UTF8 string.
25 extern char * XChar2b_to_utf8 (const XChar2b *, int *length_ret);
27 /* Split a UTF8 string into an array of strings, one per character.
28 The sub-strings will be null terminated and may be multiple bytes.
30 extern char ** utf8_split (const char *string, int *length_ret);
32 /* Converts a UTF8 string to the closest Latin1 or ASCII equivalent.
34 extern char *utf8_to_latin1 (const char *string, Bool ascii_p);
36 #endif /* __XSCREENSAVER_UTF8WC_H__ */