Convert your WordPress Database Charset and Collation to utf8

In the wp-config.php file there are two lines that define your MySQL database charset and collation.

define( 'DB_CHARSET', 'utf8' );
define( 'DB_COLLATE', 'utf8_general_ci' );

These lines should match those of your database but it’s not always like that; maybe you want to migrate the database content into another one (which is CHARACTER SET utf8 COLLATE utf8_general_ci) or maybe you just want to set reasonable defaults for your blog (avoiding the defaults, which more often than not are unknown).

Enter Utf8ize. It’s a simple WordPress Plugin but it’s a life-saver.

The goal in these conversions is always to decide on what charset/collation combination you want to use (UTF8 being the best choice in almost all scenarios) then to convert all tables/columns in your database to use that charset. At that point you can set DB_COLLATE and DB_CHARSET to the desired charset and collation to match.

It reads your database and generates SQL statements for every table and column. Then you simply copy/paste the statements into phpMyAdmin or Adminer and execute.

Just remember to change your wp-config.php accordingly and pay attention to the generated SQL statements for the specific collation (may be utf8_general_ci or utf8_unicode_ci). Set the correct values in the wp-config.php right after you run the SQL statements and you’re done.

What are your thoughts on this?

This site uses Akismet to reduce spam. Learn how your comment data is processed.