Re: PostgreSQL driver DBD::Pg releases version 3.0.0
Ron Savage <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.dbi.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Peter
I've written a demo using MySQL and will shortly expand it to Pg and
SQLite, and then blog about it, either on this list or blogs.perl.org.
It stores a string in both encoded and unencoding forms, and retrieves it.
On 07/02/14 22:59, Peter J. Holzer wrote:
> 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
>
--
Ron Savage
http://savage.net.au/