[Catalyst] Using mysql_enable_utf8

J. Shirley jshirley at gmail.com
Wed Apr 29 10:14:44 GMT 2009


2009/4/29 Octavian Rasnita <orasnita at gmail.com>

> Hi,
>
> I need to use C::M::DBI for a fulltext index with MySQL, and the tables
> contain UTF-8 data.
>
> I found that I can use mysql_enable_utf8 but I couldn't find how to use
> this option.
>
> I've tried to use it in the model in 2 places as:
>
> __PACKAGE__->config(
>   dsn           =3D> 'dbi:mysql:database=3Dintranet',
>   user          =3D> 'root',
>   password      =3D> undef,
>   options       =3D> {
> mysql_enable_utf8 =3D> 1,
> },
> mysql_enable_utf8 =3D> 1,
> );
>
> And I also tried to use it in the controller as
>
> $dbh->{mysql_enable_utf8} =3D 1;
>
> But with no success. The data still appears not encoded to UTF-8.
>
> What am I doing wrong? Or do I need to make some other configurations?
>

Try using the DSN method of enabling DBD::mysql attributes?  I don't use
Catalyst::Model::DBI, so this is just a guess, but try:

__PACKAGE__->config( dsn =3D>
'DBI:mysql:database=3Dintranet;mysql_enable_utf8=3D1' );

-J
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090429/ac906=
043/attachment.htm


More information about the Catalyst mailing list