1 #ifndef FLAC__SHARE__UTF8_H
2 #define FLAC__SHARE__UTF8_H
4 #if defined(FLAC__NO_DLL) || defined(unix) || defined(__CYGWIN__) || defined(__CYGWIN32__)
9 #ifdef UTF8_API_EXPORTS
10 #define UTF8_API _declspec(dllexport)
12 #define UTF8_API _declspec(dllimport)
13 #define __LIBNAME__ "utf8.lib"
14 #pragma comment(lib, __LIBNAME__)
22 * Convert a string between UTF-8 and the locale's charset.
23 * Invalid bytes are replaced by '#', and characters that are
24 * not available in the target encoding are replaced by '?'.
26 * If the locale's charset is not set explicitly then it is
27 * obtained using nl_langinfo(CODESET), where available, the
28 * environment variable CHARSET, or assumed to be US-ASCII.
30 * Return value of conversion functions:
32 * -1 : memory allocation failed
33 * 0 : data was converted exactly
34 * 1 : valid data was converted approximately (using '?')
35 * 2 : input was invalid (but still converted, using '#')
36 * 3 : unknown encoding (but still converted, using '?')
39 UTF8_API void convert_set_charset(const char *charset);
41 UTF8_API int utf8_encode(const char *from, char **to);
42 UTF8_API int utf8_decode(const char *from, char **to);