Subject: iconv and conversion from/to local charset and wchar_t
To: None <firstname.lastname@example.org>
From: Hendrik Sattler <email@example.com>
Date: 01/29/2004 18:53:03
I am currently programming with GNU libiconv on Debian GNU/Linux. I was told
that the NetBSD iconv implementation does some things a bit different.
Mainly, I am interested in some details about easy converting characters from
local input to an UCS-4 encoded string.
To do this, GNU libiconv suggests (for iconv_open()) using "" (empty string)
or "char" for conversion from/to charset as defined by the current locale
(char*), and "wchar_t" for conversion from/to wchar_t*.
Another method for the encoding of the string inside a char* that was read
from the system may be to use nl_langinfo(CODESET).
What is the suggested method for NetBSD's iconv implementation? Note that I
cannot really use wchar_t as I need to do assumptions about the encoding and
the numeric values of specific characters.
Currently, I do a runtime check like
and look at the return value _not_ being (iconv_t)-1.
Will this work with NetBSD's iconv implementation?
Are there any other things to check about this?
Thanks for your help