[Bins] iconv issue with bins 1.1.27 on solaris 10
Martin Michlmayr
tbm at cyrius.com
Thu Jun 16 13:11:39 BST 2005
* Bill Clarke <llib at computer.org> [2005-06-16 11:23]:
> be the result of `locale charmap` which just produces the string "646",
> which Iconv doesn't like. If I comment out the call to `locale charmap`
Does the following work on Solaris?
820:tbm at deprecation: ~] cat > t
eval {
require I18N::Langinfo;
I18N::Langinfo->import(qw(langinfo CODESET));
$codeset = langinfo(CODESET());
};
if (!$@) {
print "$codeset\n";
}
821:tbm at deprecation: ~] perl t
UTF-8
822:tbm at deprecation: ~]
If so, the patch below should help. This is probably the right
solution rather than calling locale directly.
--- bins~ 2004-10-24 19:46:23.000000000 +0100
+++ bins 2005-06-16 13:10:07.120638312 +0100
@@ -361,12 +361,16 @@
# 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);
+if (!$@ && $codeset && $codeset ne "ANSI_X3.4-1968") {
+ $defaultConfig{defaultEncoding} = $codeset;
+ beVerboseN("Forcing encoding to $codeset", 2);
}
my $local2htmlConverter;
$local2htmlConverter = Text::Iconv->new($defaultConfig{defaultEncoding},
--
Martin Michlmayr
http://www.cyrius.com/
More information about the Bins
mailing list