WordPress.org

Ready to get started?Download WordPress

Forums

Encoding errors migrating a database from one host to another (6 posts)

  1. Zootropo
    Member
    Posted 8 years ago #

    Hi. I have a problem with my wordpress based weblog at http://mundogeek.net and I would be thankful for any help you could give me to solve it.

    I'm trying to move my current database to dreamhost but I have problems with the character encoding.

    They have MySQL 4.1.15 at my previous host, and I used phpMyAdmin 2.6.0-pl3 to make the backup.
    phpMyAdmin says the MySQL charset is UTF-8 Unicode (utf8) and MySQL connection collation utf8_general_ci.

    Then, on the tables of the database it says the collation is latin1_swedish_ci. Don't know why.

    If I open, say, wp_posts in phpMyAdmin with UTF8 as charset selected in the browser, I see some strange characters instead of accents and the spanish special characters. So I don't know if the charset is truly UTF8, but WordPress options are set to use UTF8 and when I open my weblog it seems to be okay.

    Then I copied all my files to dreamhost and used 'source dump.sql' at the mysql command line to import the backup into the new database.

    Dreamhost seems to use MySQL 4.1.14 with phpMyAdmin 2.6.4-pl3. MySQL charset is UTF-8 Unicode (utf8) and MySQL connection collation utf8_general_ci, as in my previous host.

    When I open my weblog now that I moved to dreamhost I see strange characters. And if I open phpMyAdmin I see strange characters too, but they are not the same as the ones I saw when I opened phpMyAdmin in my previous host. For example where "espía" (spy) should be readed I see "espÃÂa" in Dreamhost's phpMyAdmin and "espÃa" in my previous host.

    So, please, do anybody know some reason for this to happen? Can this be a wordpress bug? MySQL's? a collation problem? some mistake I made?

    Thank you so much

  2. Zootropo
    Member
    Posted 8 years ago #

    Anyone? I asked DreamHost's support but it has been 2 days already and I still don't have any answer.

  3. Mark (podz)
    Support Maven
    Posted 8 years ago #

    It's a character encoding problem.

    Try this (I'm assuming you are on Windows)
    Download and install notepad++
    http://notepad-plus.sourceforge.net/uk/site.htm

    Use that to open your sql file
    Find a faulty character - just check what it looks like
    Now Select All
    Then from the Format menu, choose 'Encode in UTF-8'
    If there is a change to the faulty character, the sql file is wrong
    If there is not a change the new db is wrong

    If the sql file is wrong, Save the newly encoded sql file and re-import.

    If it's the db, post back and we'll see how to move forward.

  4. Zootropo
    Member
    Posted 8 years ago #

    Thank you for taking the time to try to help me podz.

    I opened the sql file in Notepad++ and I can see strange characters with ANSI format. Then I try to convert it to UTF-8 but even when the characters are not the same they are wrong too.

    I tried importing this new sql file anyway just to be sure but it doesn't seem to improve.

    does it make any sense to you? :(

  5. evaki
    Member
    Posted 8 years ago #

    I have exactly the same problem...!

    I have backed up some tables from the database (collation utf8_general_ci) just in case I screw something up -which I did- and when I try to import the tables from the backup all the characters are symbols!

    The problem I think lies in the backing up proccess... The database exports the .sql file in a I-don't-know-what encoding! I tried opening the .sql file with all sorts of processors (including notepad++) but the characters appear as symbols...

    Is there a way to fix it or should I have to put all the data by hand again? :-(

  6. moshu
    Member
    Posted 8 years ago #

    This is a MySQL bug!
    For a fix see this post: http://wordpress.org/support/topic/55282?replies=10#post-303707

Topic Closed

This topic has been closed to new replies.

About this Topic