Bug#318058: works fine under libdbd-mysql-perl 4.008-1 in unstable

WK wk at hot.ee
Wed Apr 15 20:07:26 UTC 2009


2009/4/10 Alex Muntada <alexm at alexm.org>:

> I installed mysql-server on sid without changing a single
> file, so the latin1 values seem the default to me.

Yes, it is. I wanted to make everything fully utf8 compliant, so i
changed those variables too.

> I finally found the problem: DBD::mysql does not work on
> UTF8 by default, please search for «mysql_enable_utf8»
> in perldoc. It doesn't matter that the input strings and the
> database are both in UTF8. You have to explicitly enable
> UTF8 like this:
>
> my $dbh = DBI->connect(
>    $data_source,
>    $user,
>    $password,
>    { mysql_enable_utf8 => 1 },
> ) || die "no connection\n";
>
> Alternatively, you can also use this:
>
> $dbh->do("SET NAMES utf8");

I think you are right, but i'm just confused now. I used the first
one, but i tried like this:

my $dbh = DBI->connect($data_source, $user, $password) || die "no connection\n";
$dbh->{mysql_enable_utf8} = 1;

It reports back the same way it does in your connection, i tested it like that:
warn ($dbh->{mysql_enable_utf8} ? "utf8 set up" : "utf8 not set up");

Only difference i noticed that your way has influence on data too.
Thank you! I think there is no bug in this package and it was my
fault.

One thing i can suggest: maybe this option (mysql_enable_utf8) could
be enabled automatically when database is in UTF8.



-- 
With best regards,
Kõike hääd,

WK





More information about the pkg-perl-maintainers mailing list