Hi, From: Wesley J Landaker <[EMAIL PROTECTED]> Subject: Re: char * to unicode/UTF string Date: Tue, 18 May 2004 16:49:50 -0600
> One easy way is to use the iconv calls from glibc. On most GNU-based > systems you can read about it with 'man 3 iconv', or take a look in the > glibc manual online at: > <http://www.gnu.org/software/libc/manual/html_node/index.html>, > particularly: > <http://www.gnu.org/software/libc/manual/html_node/Generic-Conversion-Interface.html>, > > and > <http://www.gnu.org/software/libc/manual/html_node/iconv-Examples.html> > > Basically, you just: > > iconv_t ic = iconv_open("UTF-8","ISO-8859-1"); // for example > // use iconv(ic,...) to do your conversions > iconv_close(ic); Please use nl_langinfo(CODESET) for encoding name of char* string, because the encoding of char* string depends on locale. On most GNU-based systems it is available. You have to call setlocale() in advance. iconv_t ic = iconv_open("UTF-8",nl_langinfo(CODESET)); instead of iconv_t ic = iconv_open("UTF-8","ISO-8859-1"); --- Tomohiro KUBOTA <[EMAIL PROTECTED]> http://www.debian.or.jp/~kubota/ -- Linux-UTF8: i18n of Linux on all levels Archive: http://mail.nl.linux.org/linux-utf8/
