On Sat, Nov 26, 2005 at 04:08:47PM +0100, Marc Espie wrote: > Looks like the charset.alias file from libiconv needs to be completed > with info about what to do with 646... > > netbsd does not have the issue because it does not use gnu libiconv... > > Just adding a line like: > > 646 ISO-8859-1 > > to /usr/local/lib/charset.alias should fix things (even though it's > slightly incorrect)
changing charset.aliases is not really a complete fix. for example, iconv(1) does not work if you use "646" as an encoding. code that is busted because it is using nl_langinfo(CODESET) to get the charset can be fixed by using locale_charset() from libiconv (or libcharset but it seems nothing uses libcharset) instead. locale_charset() takes the output of nl_langinfo(CODESET) and does the canonicalization (the lookup in charset.aliases). -- <[EMAIL PROTECTED]> as an example: #include <stdlib.h> #include <stdio.h> #include <nl_types.h> #include <langinfo.h> #ifdef USE_LIBICONV #include <localcharset.h> #endif int main(int argc, char *argv[]) { const char *codeset; const char *codeset_iconv; codeset = NULL; codeset_iconv = NULL; codeset = nl_langinfo(CODESET); #ifdef USE_LIBICONV codeset_iconv = locale_charset(); #endif if (codeset == NULL) codeset = ""; if (codeset_iconv == NULL) codeset_iconv = ""; printf("codeset = %s\n", codeset); printf("codeset_iconv = %s\n", codeset_iconv); exit(0); }