[CDBI] [Repost] Set utf8 character set on class connection?

Birgit Kellner birgit.kellner at univie.ac.at
Mon Jan 9 20:24:25 GMT 2006

Perrin Harkins wrote:

>If you switch to overriding db_Main and making the connection yourself,
>you can run the SQL to set the character set at connection time.  There
>are examples of overriding db_Main on the wiki.
>- Perrin
Thanks to all who have replied thus far. Rose::DB looks good, but I have 
still a lot to learn in term of classes and subclasses in Perl, and I 
guess I'll stick with Class::DBI for the time being.

My script now begins with:

use Class::DBI;
package ILKB::DBI;
use base 'Class::DBI';
ILKB::DBI->db_Main->do("set names utf8");

I haven't tried inserts and updates yet, but retrieval of data now works 
fine and delivers wonderful utf8 characters! Hopefully inserts and 
updates work as well, though I don't see any reason why they shouldn't.

Thanks again,


Birgit Kellner

More information about the ClassDBI mailing list