Re: PostgreSQL driver DBD::Pg releases version 3.0.0

"Peter J. Holzer" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <[email protected]>
On 2014-02-06 12:30:15 +1100, Ron Savage wrote:
> 'Major change in UTF-8 handling' is right. I was:

I haven't checked the docs yet, just my gut feeling how it should work.


> o Declaring the Pg db as utf8

I guess this means setting pg_enable_utf8?


> o Encoding outgoing data
> Eg: map{($_ => encode('utf-8', $$hashref{$_}) )} keys %$hashref

That seems superfluous to me. 

If you set pg_enable_utf8 I would expect the DBD to translate between
perl character strings (aka 'utf8 strings', but you aren't supposed to
know that and in newer perls the difference shouldn't matter any more)
and whatever encoding the database expects.


> o Decoding incoming data
> $$item{$_} = decode('utf-8', $$item{$_} || '') for keys %$item

Same here. With pg_enable_utf8 I would expect to get character strings,
not byte strings, so no decode should be necessary.

        hp

-- 
   _  | Peter J. Holzer           | I think we need two definitions:
|_|_) | WSR - Softwaredevelopment | 1) The problem the *users* want us to solve
| |   | und Projektunterstützung  | 2) The problem our solution addresses.
__/   | [email protected]             |    -- Phillip Hallam-Baker on spam
signature.asc (application/pgp-signature, 190 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iD8DBQFS9Mq+MdFfQa64PCwRAqVmAKCNado5wUzYSQyov2dwRxt9YzpK+gCfXPa6
XtLqMY2X4XD2frzzyg119Uk=
=U/vC
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.