On Fri, 11 Oct 2019, Matthias Apitz wrote:

One special problem we face at the moment is how DBD::Pg is handling UTF-8 strings in the char columns in the database. The PG server is 11.4 on Linux and DBD::Pg is 3.10.0-3.
[snip]

The resulting column contains ISO 8859-1 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 (see the chars P\303\244dagogische...):
[snip]

But why it gets translated to ISO? What do we wrong?

Hi, Matthias.

That output is from a print statement going to STDOUT, so I wonder, are you already telling Perl that you want UTF-8 output with something like this at the beginning of your script?

use open qw( :std :utf8 );

Otherwise Perl may be defaulting to writing out Latin-1.

Jon


--
Jon Jensen
End Point Corporation
https://www.endpoint.com/

Reply via email to