Re: UNIX Wide Char to Unicode

From: Jungshik Shin (
Date: Wed Sep 02 1998 - 18:07:48 EDT

On Wed, 2 Sep 1998, Smita Desai wrote:

> Can anyone please help me with converting wide character as defined in
> Solaris and other Unix platforms to Unicode. There is an ANSI C function
> mbtowc and wctomb, but that does not convert to Unicode.

  Well, what to use for wchar in ISO/ANSI C is implementation dependent.
Some implementation uses UCS-4(e.g. GNU Libc 2.x) while others might use
UCS-2(e.g X11 R6 seems to use UCS-2 as defined in Unicode 1.1 for
wc*tomb*() and mb*towc*()). Still others can use their own proprietary

  Anyway, if my memory serves me right, iconv() in Solaris 2.6 or later
supports UCS-2 and UCS-4 among others so that you should be able to
convert any (locale-dependent) encodings to UCS-2(native) and
UCS-4(native) using iconv(). I've just taken a look at the manual pages
for iconv(3), iconv(5), iconv_unicode(5) of Solaris 2.6 and confirmed
that it supports UCS-2 and UCS-4.

  This may not answer your question directly, but I guess it's of some

   Jungshik Shin

This archive was generated by hypermail 2.1.2 : Tue Jul 10 2001 - 17:20:41 EDT