This small module implements basic functions to convert strings between UTF-8 and UTF-32. It also implements functions to determine character classes (such as letter, numerics or spaces).
The API does not use any dynamic allocation and only requires C99.
// Checking classes.
printf("%d\n", uni_isletter(U'A')); // 1.
printf("%d\n", uni_isletter(U'2')); // 0.
printf("%d\n", uni_isletter(U'รง')); // 1.
// Converting UTF-32 to UTF-8.
uint32_t array[] = {...};
uint8_t str[100];
uni32_to8(array, str, sizeof (str));
You can install a development version using Mercurial
hg clone http://hg.malikania.fr/libunicode
Build using standard POSIX make tools, see INSTALL.md for more details.
make
make install
See available manual pages: