1 /* 2 convert_utf.h: 3 4 Description: header file for simple wrapper functions to convert 5 wchar_t and utf8 strings using GNU iconv(). 6 7 Copyright 2009, 2010. 8 Author: David Bruce. 9 Project email: <tux4kids-tuxtype-dev@lists.alioth.debian.org> 10 Project website: http://tux4kids.alioth.debian.org 11 12 convert_utf.h is part of Tux Typing, a.k.a "tuxtype". 13 14 Tux Typing is free software: you can redistribute it and/or modify 15 it under the terms of the GNU General Public License as published by 16 the Free Software Foundation; either version 3 of the License, or 17 (at your option) any later version. 18 19 Tux Typing is distributed in the hope that it will be useful, 20 but WITHOUT ANY WARRANTY; without even the implied warranty of 21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 GNU General Public License for more details. 23 24 You should have received a copy of the GNU General Public License 25 along with this program. If not, see <http://www.gnu.org/licenses/>. 26 */ 27 28 29 30 #ifndef CONVERT_UTF_H 31 #define CONVERT_UTF_H 32 33 #include <wchar.h> 34 35 /* NOTE the "max_length" parameter should generally be the size of the output */ 36 /* buffer. It must be at least one greater than the length of the return string */ 37 /* so that the string can be null-terminated. */ 38 /* Also, "max_length" must be no greater than the buffer length used internally */ 39 /* in these functions (i.e. UTF_BUF_LENGTH, currently 1024) */ 40 41 int ConvertFromUTF8(wchar_t* wide_word, const char* UTF8_word, int max_length); 42 int ConvertToUTF8(const wchar_t* wide_word, char* UTF8_word, int max_length); 43 44 #endif 45