On Sep 8, 2004, at 4:45 AM, Tim Bunce wrote:
On Tue, Sep 07, 2004 at 04:03:21PM -0700, David Wheeler wrote:On Sun, 08 Aug 2004 12:33:22 -0700, Tim Bunce wrote:
I'm thinking in terms of something like $sth->{SetUTF8}->[$index] = $mode
0: Force SvUTF8_off regardless undef: Do nothing (leave it up to the driver) 1: (value is well-formed utf8) ? SvUTF8_on : SvUTF8_off 2: Force SvUTF8_on regardless
(with a way to set it via bind_col as well)
And perhaps a $dbh->{SetUTF8} = $mode; to provide a default.
Umm, it's just dawned on me that the persistance of the utf8 flag
across sv_set functions means I could implement all but "1" in DBI v1.
(Option "1" requires looking at the value that's just been set and
that not simple/efficient for DBI v1.)
Hey, I just ran into a situation where I could really use this.
http://bugs.bricolage.cc/show_bug.cgi?id=709#c14
Tim, do you think this might make it into the next release of DBI v1?
I was thinking of doing at least "0" on that list for DBI 1.44.
I'd especially like to do
$dbh->{SetUTF8} = 2;
And be done with it.
I'll take a look. Patches welcome, of course!
I just started looking at this myself, but I'm not making much progress. C and XS are still somewhat of a black art to me. Tim, could you perhaps give me some pointers where to start on this? I'd like to get a database handle-level SetUTF8 working with 0 and 2 to affect whether the utf8 flag is on or off for all data fetched from the database.
I started looking at how to do it in PurePerl. It looks like it'd be fairly straight-forward to do it in _set_fbav(), yes? If so, how would you like to handle backwards compatibility? I thought I'd load Encode and use its functions to turn the utf8 flag on and off on values, but it's only available in Perl 5.8.0 and later...
Thanks!
David