« multibyte grumble | Main | what do you really want? »

finally found a fix

Well, between a quirk in the configure arguments allowed for MySQL 4.1.7 and a bad assumption made in MT 3.1, I found the place the bug in Unicode translation was creeping in. I even came up with a workaround, but it causes a cardinal sin for me: it requires modification of MT source code, something I absolutely loathe doing.

I'll be posting that to the MT dev list soon to ask if anyone else has had to do this. (Plenty of people using PHP5 have had to do this; I just didn't find any record of other MT3 users needing this hack.)

Oh, the trick itself? Just after the DBD::mysql handle is built in lib/MT/ObjectDriver/DBI/mysql.pm, you have to force a SET NAMES 'utf8' down the line. And, no, you can't override it anywhere in my.cnf; I tried seven ways to Sunday, and it just doesn't work.

If you're interested in the change in patch format, check out the extended part below.

Mad props go to Sergei Golubchik from MySQL AB (from this article) and Angie Ahl for her post last week to Web Server Talk.


--- mysql.pm 2004-12-07 22:09:31.514100000 -0600
+++ mysql.pm.orig 2004-04-28 21:43:03.000000000 -0500
@@ -50,8 +50,6 @@
{ RaiseError => 0, PrintError => 0 })
or return $driver->error(MT->translate("Connection error: [_1]",
$DBI::errstr));
- my $utf8set = qq{SET NAMES 'utf8';};
- $driver->{dbh}->do($utf8set);
$driver;
}

TrackBack

TrackBack URL for this entry:
http://blog.truegeek.org/tg-tb.cgi/1904

Post a comment

About

This page contains a single entry from the blog posted on December 7, 2004 10:56 PM.

The previous post in this blog was multibyte grumble.

The next post in this blog is what do you really want?.

Many more can be found on the main index page or by looking through the archives.

Creative Commons License
This weblog is licensed under a Creative Commons License.
Powered by
Movable Type 3.34