This is a read-only archive!

Wordpress DB migration - encoding fun

Note to self. Using mysqldump to dump a table with latin1 encoding and then editing it and importing it into a second DB with utf8 encoding isn't a lot of fun.

I found some instructions for properly opening mysqldump files in Vim with the proper encoding. I'm still somewhat confused what the difference between enc and fenc is in Vim but this worked. Eventually.

Also during the hour of banging my head on my keyboard, somewhere I read that using shell redirects to dump the mysqldump output to a file is sometimes a bad idea if there are multibyte characters in it, and instead you should use the -r flag to specify an output file. Could be true, I don't remember.

March 07, 2009 @ 6:28 AM PST
Cateogory: Programming
Tags: SQL, Vim

2 Comments

Michael
Quoth Michael on March 07, 2009 @ 5:25 PM PST

I'm not sure if this is a mysqldump problem. I think, wordpress was just broken until 2.1 or 2.2: It creates tables with latin1 encoding and writes UTF8 data into (or whatever setting you had in your admin panel). One can say mysql should refuse this, but it doesn't and what's in the tables is just garbage.

Gonzague
Quoth Gonzague on September 01, 2009 @ 8:26 AM PDT

This is giving me a hard time :-D my DB is an old one , with records encoded in UT8 but declared as latin1 by mySQL :D