6 messages in com.mysql.lists.perl[PATCH] Re: UTF-8 support in DBD::mysql| From | Sent On | Attachments |
|---|---|---|
| Dominic Mitchell | 24 Feb 2006 09:02 | |
| Jan Kratochvil | 24 Feb 2006 09:53 | .patch |
| Dominic Mitchell | 25 Feb 2006 02:32 | |
| Jan Kratochvil | 25 Feb 2006 03:05 | |
| Dominic Mitchell | 25 Feb 2006 11:12 | |
| Dominic Mitchell | 07 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





.patch