/*---------------------------------------------------------------------------- libtunepimp -- The MusicBrainz tagging library. Let a thousand taggers bloom! Copyright (C) Robert Kaye 2003 This file is part of libtunepimp. libtunepimp is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. libtunepimp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with libtunepimp; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA $Id: utf8.h 1412 2005-07-01 07:25:03Z robert $ ----------------------------------------------------------------------------*/ /* * Convert a string between UTF-8 and the locale's charset. * Invalid bytes are replaced by '#', and characters that are * not available in the target encoding are replaced by '?'. * * If the locale's charset is not set explicitly then it is * obtained using nl_langinfo(CODESET), where available, the * environment variable CHARSET, or assumed to be US-ASCII. * * Return value of conversion functions: * * -1 : memory allocation failed * 0 : data was converted exactly * 1 : valid data was converted approximately (using '?') * 2 : input was invalid (but still converted, using '#') * 3 : unknown encoding (but still converted, using '?') */ #ifndef __UTF8_H #define __UTF8_H #ifdef __cplusplus extern "C" { #endif int convert_buffer(const char *fromcode, const char *tocode, const char *from, size_t fromlen, char **to, size_t *tolen); void convert_set_charset(const char *charset); int utf8_encode(const char *from, char **to); int utf8_decode(const char *from, char **to); #ifdef __cplusplus } #endif #endif /* __UTF8_H */