Sabyasachi Chandra writes:
> does anyone know, if there is any C routine available that converts
> an UTF-8 string to UTF-16 string and the vice versa.
You can do it by using the iconv_string wrapper [1] around the
system's iconv routine (recommended on glibc 2.2 or newer), passing it
"UTF-8" as fromcode and "UTF-16" as tocode.
Aternatively, you should be able to build a specialized conversion
function by putting together the (LGPL'ed) functions 'utf8_mbtowc' in
[2] and 'utf16_wctomb' in [3] in a loop.
Bruno
[1]
http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/clisp/libiconv/extras/iconv_string.c?rev=1.3&content-type=text/x-cvsweb-markup&cvsroot=clisp
[2]
http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/clisp/libiconv/src/utf8.h?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=clisp
[3]
http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/clisp/libiconv/src/utf16.h?rev=1.3&content-type=text/x-cvsweb-markup&cvsroot=clisp
-
Linux-UTF8: i18n of Linux on all levels
Archive: http://mail.nl.linux.org/lists/