I'd like my DB to be full utf-8
May 12, 2007 6:42 AM   Subscribe

help me convert a mySQL database to UTF-8.

Hive, I'm turning you as my last hope.

ladies and gentlemen, here are the facts

- I have french-speaking, 2.1 wordpress blog, with posts full of the funny frenchy accented letters (é,à,ù, etc.) hosted at dreamhost (not one-click-installed, manually installed)
- charset in the html pages displayed is set as ISO-8859-1. Just switching from ISO 8859-1 to UTF-8 in the admin interface will not solve the problem, only display "?" where there are accented letters.
- I suspect my DB is in fact a mix of ISO-8859-1 and UTF-8 (I've moved hosts)
- anyway, I want it to be full and integral UTF-8 (character set and collation connexion)

There are similar complaints to mine in the wordpress support forums but I haven't been able to find a "magic bullet" solution.

Or have I ?

This :

http://sungnyemun.org/code/fixEncodings.py.gz

claims to be just the ticket but I lack the basic python synthax knowledge that are required for this tool. (I have shell access to my dreamhost account)

So... can you please

- tell me if it looks like this script does what's advertised
- show me the shell and python ropes to run that script on a mysql dump (let's say it's called dumpoftheday.sql)

if the script is not the magic bullet, can you please help me find a way to have a nice, shiny and full utf-8 mysql database.

many thanks in advance !
posted by Baud to Computers & Internet (3 answers total)
 
- tell me if it looks like this script does what's advertised
Yes, it does look like that, and it appears to do it quite intelligently too; if a field is already valid UTF-8 it won't convert it, if it isn't it assumes it's ISO-8859-1 and converts from that. But, this is IT, the Palatinate of Chaos Theory, and I haven't checked it, so I can't confirm without having run it.
- show me the shell and python ropes to run that script on a mysql dump (let's say it's called dumpoftheday.sql)
Do you have a local MySQL server, and copy of the site? If so, import the dump file into it— mysql -u user -p pass < dump-file.sql /code> —and edit the script to reflect the user, password and database name. Run it, and check that the encoding is okay locally; if so, upload the file to the live server, edit it to reflect the user, password and database name, run python fixencodings.py, and you should be okay. Back up everything first, but you appear to know that already :-) .
posted by Aidan Kehoe at 8:07 AM on May 12, 2007


Response by poster: I could try with easyphp but if someone could be kind enough to tell the correct syntax i need to enter in the shell, my life would be much easier

I guess it's something rougly like : prompt : nameofthescript.py nameofthedump.sql but I need the exact correct syntax

thanks for the help, anyway
posted by Baud at 10:35 AM on May 12, 2007




« Older I wanna know...have you ever seen the rain?   |   I'm bleeding from my hands. So why can't I hear? Newer »
This thread is closed to new comments.