<<< Date Index >>>     <<< Thread Index >>>

Re: national chars - libiconv not used?



 On Tuesday, June 20, 2006 at 8:48:58 +0200, Michal Hajek wrote:

    [locale]              [charmap]               [CODESET]
| cs_CZ.IBM-852         "charmaps/IBM852.cm"    charset="roman8"
> cs_CZ.iso88592        "iso88592.cm"           charset="roman8"
> en_US.iso88591        "iso88591.cm"           charset="roman8"
> en_US.utf8            "utf8.cm"               charset="roman8"

    Aaargh, your HP-UX nl_langinfo(CODESET) is broken. Strangely I've
seen elsewhere that HP-UX 11.x is able to give not really canonical but
true CODESETs, like "iso88592", "utf8", or "eucKR". Maybe look if it has
a locale to CODESET mapping file of some sort (on Glibc I sometimes had
to tweak /usr/lib/gconv/gconv-modules). Otherwise just continue to
hardcode $charset="IBM852" in muttrc... And all other apps.

    I wonder if libcharset:locale_charset() gets fooled too. Probably
yes, as it gets nl_langinfo(CODESET) where available, and then
canonicalizes it. Probably would shout "HP-ROMAN8". Test attached.


 On Tuesday, June 20, 2006 at 9:18:32 +0200, Michal Hajek wrote:

> OK, I downloaded a few better binaries :-)

    At least one positive effect of our discussions! Last time the
"patch" command, this time "printf", in 2010 next time I'll present you
GNU ls. ;-)


> /usr/bin/iconv -f utf8
> iconv: can not initialize the conversion

    Hum... Either it is unaware of what is current CODESET, or it has no
conversion table from utf8 to roman8. Can you try:

| $ /opt/sh_utils/bin/printf "Ren\xC3\xA9\n" | /usr/bin/iconv -f utf8 -t roman8

    BTW as "UTF-8" is the sole canonical and MIME name, it would be good
to add to alias section of config.iconv:

| alias utf8 utf-8


> /usr/bin/iconv -f iso-8859-1 -t ibm852
> iconv: can not initialize the conversion

    Unlike libiconv which can convert anything to anything, HP iconv
seems to need a declared converter for each pair of charsets. So you
would need to tweak further config.iconv like perhaps:

| # experimental
| iso81 cp852   iso81=cp852     default         -
| cp852 iso81   cp852=iso81     default         -


Bye!    Alain.
-- 
Software should be written to deal with every conceivable error
        RFC 1122 / Robustness Principle
/* Prints the portable name for the current locale's charset.
 * Build with gcc -o locale_charset locale_charset.c -lcharset
 * to catch /usr/local/lib/libcharset.so.1
 * Or -liconv to catch /usr/local/lib/libiconv.so.2
 * Or -lintl  to catch /usr/local/lib/libintl.so.2
 */

#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <localcharset.h>

int main ()
{
  setlocale(LC_ALL, "");
  printf("%s\n", locale_charset());
  exit(0);
}