Tuesday, May 24, 2011

MySQL + Ruby + UTF-8 + legacy = Hell

After fighting a bloody war with an old (broken) database with (partial) latin1 character encoding, a server with utf8 and partially broken support in Ruby plugins for UTF-8 in MySQL, I gave up.

If you have databases that give odd characters, the only thing that worked for me in the is to manually sed out all brokenness from a dump of the old database.

Dump your old database, run the following script over it, and re-import it into a utf8 database.


No comments: