WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Easier way to convert database charset from latin1 to utf8 ?

[Resolved] Easier way to convert database charset from latin1 to utf8 ?

  • ymf
    Participant

    @ymf

    I discovered that in my database I have a mix of 10 legacy latin1_swedish_ci-collated tables (DEFAULT CHARSET=latin1) and some new utf8_general_ci-collated tables (DEFAULT CHARSET=utf8). A symptom is that foreign (e.g. Cyrillic) characters in posts and comments are displayed as question marks. The config file contains

    define(‘DB_CHARSET’, ‘utf8’);
    define(‘DB_COLLATE’, ”);

    I’d like to convert the database to only use the new utf8_general_ci-collated tables (DEFAULT CHARSET=utf8). I found a codex guide http://codex.wordpress.org/Converting_Database_Character_Sets with elaborate, and presumably correct, instructions.

    I wonder, is that the only reliable way? Or is there an easier way to convert database charset from latin1 to utf8 ?

    E.g. when I look at the database’s backed up SQL file, it contains fragments like this:

    DROP TABLE IF EXISTSwp_comments;
    /*!40101 SET @saved_cs_client = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE wp_comments (

    ) ENGINE=MyISAM AUTO_INCREMENT=81 DEFAULT CHARSET=latin1;
    /*!40101 SET character_set_client = @saved_cs_client */;

    What if I change in the these fragments the keywords “latin1” to “utf8” and restore the database?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Easier way to convert database charset from latin1 to utf8 ?’ is closed to new replies.