ข้ามการนำทาง

Your texts are showing as ??????? because your database character encoding is different from UTF-8.

If you’re using PHPMyAdmin, the structure of your wp_posts table should look something like this:

wp_posts viewed from PHPMyAdmin

If you see a different value for the collation, it means that the character encoding is wrong. This will cause text to display incorrectly because the browser doesn’t know how to show non-English characters.

How can I fix this issue?

First, make sure to backup your database.

All you need to do is run ALTER statements which will go through your data and change it from its current encoding to UTF-8. The easiest way to do this is by using the Database Collation Fix plugin.

In essence, your database needs to be adjusted using the following two SQL statements:

ALTER TABLE $table DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
ALTER TABLE $table CHANGE $field_name $field_name $field_type CHARACTER SET utf8 COLLATE utf8_bin

How can I prevent this from happening again?

Finally, to make sure that you’re not skewing away from UTF-8 in the future, edit your wp-config.php file and set the charset definition correctly.

It should say:

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');