ft2-clone

Fasttracker 2 clone
Log | Files | Refs | README | LICENSE

utf8.h (816B)


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