Faulty restore of the database, encoding issue

I messed up the settings with W3 Total Cache (tried to import all the media to my library, didn’t work out well, broke all my links to every picture).
So I took my latest backup of the database, copy/paste the _post and _postmeta tables inside my phpmyadmin.
It brought back the links and pictures as expected, but now all the french characters (à,é,è etc) are not displayed properly.

I took the backup from the plugin WP-DBManager, which doesn’t seem to handle UTF-8 properly.
What’s the fastest way to correct the issue ?

Thanks

Edited for more details:
The SQL backup header is

DROP TABLE IF EXISTS `hojd_posts`;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;

However I have those characters badly encoded coming directly in my sql commands (eg: français for “français”)…

3 Answers
3

You might be able to solve this if you have a text editor with good encoding support. That way, you could switch between the Latin 1 and the UTF-8 encoding until you have the right combination. I use SubEthaEdit which can convert but also reinterpret a file when you change the encoding.

The ç should be encoded as c3 a7 in UTF-8 when you view them as bytes. What could be happening here is that the file was interpreted as Latin 1 first, where c3 a7 means ç, and then saved as UTF-8, where ç is saved as c3 83 c2 a7. You want the c3 a7 version.

The way to get back to a nice ç is to open the file as UTF-8, save it as Latin-1, and then open it again as if it was UTF-8.

Once you did this, you can import the file into MySQL, but specify it is UTF-8, otherwise MySQL might try to interpret it as Latin 1 and you will still have the ç characters.

Leave a Comment