There seems to be something wrong with the UTF-8 encoding of
$DBI::errstr. The little program below, which tries to
connect to a non-existing PostgreSQL database, prints
in case of LC_ALL="en_US.utf8":
could not translate host name "unknown" to address: [...]
which is fine, but for LC_ALL="de_DE.utf8", it prints
konnte Hostname »unknown« nicht in Adresse übersetzen: [...]
which is wrong! It should be:
konnte Hostname »unknown« nicht in Adresse übersetzen: [...]
Environment:
OS : Gentoo Linux x86_64
PostgreSQL : 8.4
Perl : 5.8.8 and 5.10.1
DBD::Pg : 2.15.1, 2.16.0
DBI : 1.609
LC_ALL : de_DE.utf8
How to repeat:
---------------------------------------------------------------------
pgtest.pl (encoding is utf8)
use 5.8.0;
use utf8;
use strict;
use warnings;
use DBI;
binmode(STDOUT, ":utf8");
binmode(STDIN, ":utf8");
binmode(STDERR, ":utf8");
print "\näöüÄÖÜß\n";
my %dbattr = (
PrintError => 0,
RaiseError => 0,
AutoCommit => 0,
pg_enable_utf8 => 1
);
my $dbh = DBI->connect("DBI:Pg:dbname=10.0.30.2;host=unknown;port=10000",
'unknown', 'unknown', \%dbattr);
print $DBI::errstr . "\n";
---------------------------------------------------------------------
export LC_ALL="en_US.utf8"
perl pgtest.pl
äöüÄÖÜß
could not translate host name "unknown" to address: Name or service not known
(OK)
export LC_ALL="de_DE.iso8859-1"
perl pgtest.pl
äöüÄÖÜß
konnte Hostname »unknown« nicht in Adresse übersetzen: [...]
(OK)
export LC_ALL="de_DE.utf8"
perl pgtest.pl
äöüÄÖÜß
konnte Hostname »unknown« nicht in Adresse übersetzen: [...]
(not OK)