List:MySQL and Perl« Previous MessageNext Message »
From:Dominic Mitchell Date:February 25 2006 11:33am
Subject:Re: UTF-8 support in DBD::mysql
View as plain text  
Jan Kratochvil said:
> On Fri, 24 Feb 2006 18:02:27 +0100, Dominic Mitchell wrote:
>> 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
>
> It looks also as a hack. It should properly retrieve the charset of the
> retrieved column but currently DBD::mysql does not parse it enough to be
> able to mark it appropriately.

It is a hack, but it's a useful one.  General charset support is not
needed.  It's only UTF-8 support that needs special handling by Perl.

You could get into long details about the correct API for transcoding
automatically into the desired charset from whatever charset the database
has stored your data in.  But it smacks of overengineering, and not making
the common case simple.

UTF-8 support in Perl is a special case amongst all charsets, so I feel
it's worth adding a little bit of help for it.  You wouldn't have to /use/
the proposed hack.  But it's there for people like me who do need it.

> In fact I gave up and rather mark it utf-8 by hand from Perl when
appropriate.

That's exactly what I *don't* want to be doing.  I gave it UTF-8 -- it
should be able to give me UTF-8 back.

-Dom

Thread
UTF-8 support in DBD::mysqlDominic Mitchell24 Feb
  • Re: UTF-8 support in DBD::mysqlJan Kratochvil24 Feb
    • Re: UTF-8 support in DBD::mysqlDominic Mitchell25 Feb
      • Re: UTF-8 support in DBD::mysqlJan Kratochvil25 Feb
        • Re: UTF-8 support in DBD::mysqlDominic Mitchell25 Feb
  • [PATCH] Re: UTF-8 support in DBD::mysqlDominic Mitchell7 Mar