Friday, October 30, 2015

Wordpress posts show question marks

I installed Wordpress on my local server, when I moved it onto remote server, all posts show just question marks like this:

?????

What I did was: mysqldump, then mysql in.

Later after lots of search, inspired by this post:

https://mathiasbynens.be/notes/mysql-utf8mb4 

I found all I need to do is to set remote database server to use utf8mb4.

Be careful, all database, tables and columns by the newest Wordpress are already utf8mb4, so I did not touch them. Just to this to change your mysql database server to use utf8mb4. Every line is needed:

[client]
default-character-set=utf8mb4

[mysql]
default-character-set=utf8mb4

[mysqld]
character-set-client-handshake=FALSE
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci

Especially this line:
character-set-client-handshake=FALSE

I don't know why Wordpress php need this line, but it do have effect. If someone know, please let me know. Thanks!

Search

Google