xref: /aosp_15_r20/external/flac/include/share/utf8.h (revision 600f14f40d737144c998e2ec7a483122d3776fbc)
1*600f14f4SXin Li #ifndef SHARE__UTF8_H
2*600f14f4SXin Li #define SHARE__UTF8_H
3*600f14f4SXin Li 
4*600f14f4SXin Li /*
5*600f14f4SXin Li  * Convert a string between UTF-8 and the locale's charset.
6*600f14f4SXin Li  * Invalid bytes are replaced by '#', and characters that are
7*600f14f4SXin Li  * not available in the target encoding are replaced by '?'.
8*600f14f4SXin Li  *
9*600f14f4SXin Li  * If the locale's charset is not set explicitly then it is
10*600f14f4SXin Li  * obtained using nl_langinfo(CODESET), where available, the
11*600f14f4SXin Li  * environment variable CHARSET, or assumed to be US-ASCII.
12*600f14f4SXin Li  *
13*600f14f4SXin Li  * Return value of conversion functions:
14*600f14f4SXin Li  *
15*600f14f4SXin Li  *  -1 : memory allocation failed
16*600f14f4SXin Li  *   0 : data was converted exactly
17*600f14f4SXin Li  *   1 : valid data was converted approximately (using '?')
18*600f14f4SXin Li  *   2 : input was invalid (but still converted, using '#')
19*600f14f4SXin Li  *   3 : unknown encoding (but still converted, using '?')
20*600f14f4SXin Li  */
21*600f14f4SXin Li 
22*600f14f4SXin Li int utf8_encode(const char *from, char **to);
23*600f14f4SXin Li int utf8_decode(const char *from, char **to);
24*600f14f4SXin Li 
25*600f14f4SXin Li #endif
26