6 messages in com.mysql.lists.perl[PATCH] Re: UTF-8 support in DBD::mysql
FromSent OnAttachments
Dominic Mitchell24 Feb 2006 09:02 
Jan Kratochvil24 Feb 2006 09:53.patch
Dominic Mitchell25 Feb 2006 02:32 
Jan Kratochvil25 Feb 2006 03:05 
Dominic Mitchell25 Feb 2006 11:12 
Dominic Mitchell07 Mar 2006 06:02.patch
Subject:[PATCH] Re: UTF-8 support in DBD::mysql
From:Dominic Mitchell (Domi@semantico.com)
Date:03/07/2006 06:02:23 AM
List:com.mysql.lists.perl
Attachments:

Dominic Mitchell wrote:

Are there any plans to introduce UTF-8 support to DBD::mysql? At the moment, when I retrieve UTF-8 data from MySQL, it doesn't have the UTF-8 flag set on the returned string. This means that I have to litter my code with calls to Encode::decode_utf8().

Ideally, I'm looking for something like PostgreSQL's pg_enable_utf8 flag: http://search.cpan.org/~dbdpg/DBD-Pg-1.44/Pg.pm#pg_enable_utf8

If it's agreed that the functionality is desired, I'm happy to create a patch based on the PostgreSQL support.

Ok, this is a reworking of the previous UTF-8 patch, with the following features:

* Only turned on if defined(sv_decode_utf8) && MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION.

The first requirement is so that the functions are actually available in Perl. The second is because there doesn't appear to be any column type information available in the older branch of dbd_st_fetch. If somebody could point out how to do that, I would be most appreciative.

* The patch includes a way to retrieve the value of the flag as well as set it. :-)

* This patch includes the fix for quote() that I posted last week.

* I've included a test to ensure that we can get UTF-8 out of the database again.

This is all patched against DBD::mysql 3.0002_5.

-Dom