Support » Installing WordPress » Encoding errors migrating a portuguese database from one host to another

  • Resolved brunotorres


    Hello all.
    I have a wordpress weblog at Its language is brazilian portuguese and I’m having some troubles trying to migrate it to my new host on dreamhost.
    My current database is probably an older mysql version, and it has no ‘collation’ field on the tables. It is encoded as UTF-8 (If I open it on phpmyadmin with my browser set to utf-8 encoding, all special characters are shown properly). My weblog ‘reading’ options are set to use UTF-8 on the output.
    Well, now I got a new hosting on dreamhost and it seems to use a newer mysql version, with the evil collation field.
    I used the one-click installation, which makes things easier and gets the latest wordpress version. I ran the /wp-admin/install.php, all the tables were created with the weird ‘latin1_swedish_ci’ collation.
    So, I went to phpmyadmin on the current server (I have no shell access on it) and exported all the database tables (except wp_options) and imported them on the new server’s phpmyadmin. Just to remember, the current database is encoded as UTF-8 and so I did in the new one.
    Then, i entered the new wordpress admin interface, set everything up (and set the output charset to UTF-8). But, when I go to the blog, it shows weird symbols instead of the special characters, like é á ã, used in brazilian portuguese.
    I tried to import the database as ISO-8859-1 and it still doesn’t work.
    The odd thing is that, even my database being encoded as UTF-8, if I set the options to ISO-8859-1, it works properly (ok, you can say, leave it as ISO-8859-1 bu, heck, I want it as UTF-8…it has to work 😉 )
    Another odd thing is that if I post something from the admin interface, all the special characters are shown properly on the blog, but not on phpmyadmin. I trued utf-8, iso-8859-1, windows-1252 and some other charsets and none of them worked (on phpmyadmin).
    So, please, can anyone help me with this? Is this a wordpress bug, a MySQL bug, a collation problem or simply I’m doing the wrong thing?
    Any help is appreciated.
    PS: If you access you’ll see everything working, but this is because it’s still hosted on the old server. I have to figure out what is happening to be able to migrate to dreamhost.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Try a search for “latin1_swedish_ci collation” – you may find several ideas how to deal with it.

    I have searched for it, but none of the answers helped me.
    Look, I edit a database in utf-8 and it only works as iso-8859-1. It’s too weird.
    I tried to use utf8_general_ci collation, but it didn’t work.
    There has to be an answer to this…
    Thanks, anyway.

    Doing presumably the same search I’ve found answers saying do not change the collation from latin1_swedish_ci in the new database.

    Yes, I found this. But, changing or not changing, I get to the same problem.
    See, if I write a post from the wp admin interface, all the special characters appear well on the weblog. But they appear as weird symbols on phpmyadmin. Even if I use UTF-8 or ISO-8859-1.
    I can import my database as ISO or as UTF-8 and it only works as ISO. It only works as UTF-8 if I post from the user interface.
    Since, I’m migrating and have a bunch of posts written, I’m not supposed to post all of them from the admin interface. Or am I?
    It is a really weird thing. There must be a solution to this and, please, don’t get me wrong but I have made lots of searches on this subject.
    And I don’t want to use ISO-8859-1. So, anyone has a real solution to this?

    I wouldn’t worry about how do they look in phpmyadmin. (I have far more accented characters in the Hungarian alphabet than you have in Portuguese, and they all look weird in the database… but since they do display correctly – I don’t really care!)

    So the problem comes down to the importing issue only, since nobody is looking at the characters in a database:
    I remember similar problems posted – if I find something useful I’ll post back.

    Well, instead of using phpmyadmin, I imported the database from the ssh shell, using:
    mysql -u user -p -h host < databasefile.sql
    The file was created from an export operation on phpmyadmin and was saved as utf-8.
    It just worked. At least so far.
    If I find any other problem or the definite solution to this, I’ll post here again.
    Thanks a lot for the time you took to help me!

    Did you see this post?

    Edit. Seemingly we posted in the same time. Good that finally you got the solution.

    That’s right !

    You do not need to worry about utf-8 or how weird the characters look in the database.

    You may have screwed up something in your database.

    If your language was Brasilian Portuguese then it should be the same in your new database, as well.
    Latin1_swedish_ci is certainly wrong.

    I do not know how things goes at Dreamhost, perhaps you may ask for instructions from the support.

    Wooo !

    Shooting at the same time !

    All is well, then 🙂

    I have a certain similar problem, only with a twist, in short: after the migration of the DB, I see the SPANISH characters correctly in phpmyadmin (which has it ‘latin1_swedish_ci’ collation), but in my blog the spanish characters appear just wrong.
    I tried changing the collation of the DB to latin1_spanish_ci
    but didnt work.
    any ideas please?
    I’m hosting on BlueHost. Still waiting for more help from them too.

    I agree with you laslo, I never thought something would happen to my site , however I exported the database with the weird character and open it with a text editor. Then I search for the werid characters and replaced it with the original ones. After that I uploaded the database and WOOM, it works.. however now its a pain to check every characters. Am still firguring a way to solve this. Hope it helps. If you need help just contact me thru the web. 🙂

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Encoding errors migrating a portuguese database from one host to another’ is closed to new replies.