develooper Front page | perl.dbd.pg | Postings from July 2011

Re: [DBD::Pg 2/2] Commit UTF-8 design notes/discussion between DWC/GSM

Thread Previous | Thread Next
From:
David Christensen
Date:
July 21, 2011 16:23
Subject:
Re: [DBD::Pg 2/2] Commit UTF-8 design notes/discussion between DWC/GSM
Message ID:
CF47EA24-A970-4B06-887A-6C5B38169667@endpoint.com

On Jul 21, 2011, at 6:16 PM, David E. Wheeler wrote:

> On Jul 21, 2011, at 4:01 PM, Greg Sabino Mullane wrote:
> 
>>> I think that setting pg_encoding should always turn pg_unicode *on*.
>> 
>> Hm...no, I think it should always be off. If someone really wants a different 
>> encoding, they probably are used to it coming back "raw". David C, 
>> I think we talked about this?
> 
> I disagree. It's me telling DBD::Pg what encoding the database uses, but I definitely want that converted to Perl's internal form. I *only* want raw if I explicitly ask for raw (or if there's no choice, such as when I set the encoding to ":raw" or something).

As a developer, why would you care if this information is available from the database itself?  If you are caring about the encoding at all, you would be dealing with bytes/octets.  Perl does not store unicode characters in any format besides UTF-8 so you're not changing "internal" characteristics ; what DBD::Pg uses to talk to your database shouldn't matter.

> I think of it being kind of like the `encdoding` pragma, in which I declare the encoding of my source code. Perl sees that and converts it to its internal form.

The only time this would be useful would be if your database is set to something inscrutable (aka SQL_ASCII); if your end result is meant to be internal perl, you have no business providing an encoding.

>>> Maybe. I think a lot of existing installations may find they need to 
>>> turn it off, unless they had been using pg_enable_utf8 before.
>> 
>> Yep: no way to know until we release. David and I were thinking that the 
>> other direction (data going to database) is probably more likely to 
>> break things.
> 
> I wonder if, as an interrime measure, existing code that sets pg_enable_utf8 should still do something, like set pg_encoding to "utf-8" and turn pg_unicode on.

Yeah, I'd had that thought, along with spitting the deprecation warning.

>>> Oh I agree, I just think it's worth putting off until this other stuff 
>>> gets sorted out.
>> 
>> Nah, the more stuff we can fix out of the gate the better.
> 
> Okay.

+1.

>>> Have you asked Tim Bunce about any of this stuff? I know he has 
>>> thought about adding encoding knobs to the DBI core, but I don't 
>>> know how far a long he got in thinking about a design.
>> 
>> Good idea: I have not. Will try to do so. Or anyone else that wants to 
>> raise this on dbi-dev....
> 
> Yes, a must, IMHO. More cooks! ;-P


Yeah, it'd be nice to know what at least some proposed interfaces/APIs are so we don't need to support a whole other place setting for years to come.

Regards,

David
--
David Christensen
End Point Corporation
david@endpoint.com





Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About