[Bins] iconv issue with bins 1.1.27 on solaris 10

Martin Michlmayr tbm at cyrius.com
Fri Jun 17 01:34:51 BST 2005


* Bill Clarke <llib at computer.org> [2005-06-17 10:26]:
> 646
> $
> 
> so that's no good, i think.

Google shows that refers to US-ASCII (ISO 646).  One link [0] says:

+  /* On Solaris the default encoding, as returned by nl_langinfo(),
+     is `646' (aka ASCII), but the Solaris iconv_open() doesn't
+     understand that, so we use the default value instead.  */

So how about:

--- bins~	2004-10-24 19:46:23.000000000 +0100
+++ bins	2005-06-17 01:34:22.599973576 +0100
@@ -361,12 +361,17 @@
                                          # files.
 );
 
-my $localEncoding = `locale charmap`;
+my $codeset;
+eval {
+    require I18N::Langinfo;
+    I18N::Langinfo->import(qw(langinfo CODESET));
+    $codeset = langinfo(CODESET());
+};
 # ANSI is unspeakably primitive, keep LATIN1 instead
-if ($? == 0 && $localEncoding && ($localEncoding ne "ANSI_X3.4-1968")) {
-  chop($localEncoding);
-  $defaultConfig{defaultEncoding} = $localEncoding;
-  beVerboseN("Forcing encoding to $localEncoding", 2);
+# Solaris refers to ISO 646 as "646" but that is not a valid codeset
+if (!$@ && $codeset && $codeset ne "ANSI_X3.4-1968" $codeset != 646) {
+  $defaultConfig{defaultEncoding} = $codeset;
+  beVerboseN("Forcing encoding to $codeset", 2);
 }
 my $local2htmlConverter;
 $local2htmlConverter = Text::Iconv->new($defaultConfig{defaultEncoding},


[0] http://gcc.gnu.org/ml/java/2002-03/msg00631.html
-- 
Martin Michlmayr
http://www.cyrius.com/


More information about the Bins mailing list