Christoph, May I come back to the UTF-8 problem, but now for the reading aspect: I connect to the PG server with: $dbh = DBI->connect($PGDB, $PGDB_USER, $PGDB_PASS, { pg_utf8_flag => 1, pg_enable_utf8 => 1, AutoCommit => 0, RaiseError => 0, PrintError => 0, } ); and do a SELECT for a column which contains UTF-8 data (I double checked this with SQL and ::bytea): $sth=$dbh->prepare( "select d02name from d02ben where d02bnr = '00001048313'") or die "parse error\n".$DBI::errstr."\n"; $sth->execute or die "exec error\n".$DBI::errstr."\n"; but when I now fetch the first row with: @row = $sth->fetchrow_array; $HexStr = unpack("H*", $row[0]); print "HexStr: " . $HexStr . "\n"; print "$row[0]\n"; The resulting column contains ISO data: HexStr: 50e46461676f67697363686520486f6368736368756c65205765696e67617274656e2020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020 P<E4>dagogische Hochschule Weingarten Following the man page of DBD::Pg the attribute pg_enable_utf8 => 1 should ensure that strings are returned from DBI with the UTF-8 flag switched on. The server sends the string in UTF-8 as I can see with strace: ... recvfrom(3, "T\0\0\0 \0\1d02name\0\0\1\313\237\0\3\0\0\4\22\377\377\0\0\0|\0\0D\0\0\0\203\0\1\0\0\0yP\303\244dagogische Hochschule Weingarten C\0\0\0\rSELECT 1\0Z\0\0\0\5T", 16384, 0, NULL, NULL) = 185 write(1, "HexStr: 50e46461676f67697363686520486f6368736368756c65205765696e67617274656e2020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020\n", 249) = 249 write(1, "P\344dagogische Hochschule Weingarten But why it gets translated to ISO? Thanks for your help again. matthias -- Matthias Apitz, ✉ guru@xxxxxxxxxxx, http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub
Attachment:
signature.asc
Description: PGP signature