Subject: Re: iconv and conversion from/to local charset and wchar_t
To: None <>
From: Hendrik Sattler <>
List: tech-userlevel
Date: 01/31/2004 02:34:30
Am Freitag, 30. Januar 2004 18:25 schrieb Noriyuki Soda:
> That's because you combined different vendor's libraries.
> NetBSD-1.6.x didn't have native iconv() library, so, your choice is
> the only option fot the NetBSD-1.6.x branch. And in that case, the
> codeset-name-conversion function like what I described in [1] is
> needed to combine functions from different vendors:
> But NetBSD-current, Linux and any commercial UNIXes have iconv() and
> nl_langinfo() in same library (libc), in this case, you can assume
> consistency about codeset names between iconv() and nl_langinfo().

Great. Then I just revert all that iconvtest stuff and go back to 
nl_langinfo(CODESET) usage:
from current unicode.c:
#  include <langinfo.h>
char* get_system_charset () {
  return "ANSI_X3.4-1968";
  /* The default implementation uses nl_langinfo(CODESET)
   * If this gives you problems with your mixture
   * of libc and libiconv, fix it here.
#  endif
  return nl_langinfo(CODESET);

This makes it easy for NetBSD-1.6.x-Maintainer to apply a simple patch (in the 
else case) as glue. Eventually, I include it when the replacement list is 
complete at one time.

> From SUSv3 point of view, the state of NetBSD-1.6.x is incomplete,
> and it is better to treat it as a special case.

Probably. NetBSD was the only system causing such a problem (except 
always-special-case Cygwin). You mentioned Solaris 8&9 but scmxx doesn't 
compile on Solaris, yet (see below).

> That doesn't mean NetBSD-1.6.x shouldn't be supported in scmxx,
> so, you are right and what I wrote in [2] isn't enough (I forgot
> to mention that it doesn't apply to NetBSD-1.6).

However, checking a long list of strings on every conversion is not what I 
long for.
Maybe the NetBSD-1.6 libiconv-Maintainer can make a central patch to his 
packet (syncing charset names with NetBSD's libc). That would really solve it 
for NetBSD-1.6.

Thanks a lot for an overview of this issue :)
The Solaris port has other problems (Solaris doesn't have getopt_long(), at 
least I don't know which headers or libs are necessary for it ;)

Changes to use self-defined ucs4char_t, ucs2char_t and gsmchar_t are now in 
CVS. Tested and runs better than before ;)
And hey, this may even make it easier for MacOS X (wchar.h but no wcslen()).