Bruno Haible <[EMAIL PROTECTED]>:
> Markus Kuhn wrote:
> > now you can finally provide in a
> > standardized way to the C library a Unicode wchar_t string, and then it
> > will do the I/O in the locale-dependent character encoding for you.
>
> Only in glibc is wchar_t == Unicode. In other OSes, like FreeBSD,
> wchar_t is not Unicode.
For my curiosity, what is it in FreeBSD? And does anyone used a signed
wchar_t, and does anyone use any negative values of it?
> > I need the conversion between Unicode and the default locale-dependent
> > byte encoding. I know how to do it assuming that wchar_t is Unicode.
> > Am I right that there is no portable way do to it otherwise ...?
>
> No. The portable alternative is "iconv". (iconv is portable, because
> if it is not contained in the C library, the libiconv substitute can
> be used.)
If you want to succeed with the system's iconv and not require
libiconv, you can convert via UTF-8 using your own UTF-8 encoder and
decoder. It would be more efficient to convert via UCS-4, say, but you
can never be quite sure what the implementer of iconv might have
called UCS-4, even if they do have it. In fact, as far as iconv is
concerned, "UTF-8" is almost the only portable character set name
there is.
Edmund
-
Linux-UTF8: i18n of Linux on all levels
Archive: http://mail.nl.linux.org/lists/