' showing up as ? on Wordpress site live serve

2019-06-14 09:39发布

This question already has an answer here:

I have a wordpress site which I have set up on my localhost. I've just uploaded it to my hosting and imported the database but all the ' are displaying as � . I thought it might just be my posts as you can see from this example here.

However if you look at the below image you can see that its even happening in the wordpress admin panel.

enter image description here

I thought it might be related to the way the database is set up but I have checked and they have all the exact same settings. I tried setting up a new database and importing the data to that and it didnt help.

Does anyone have any ideas would could be causing this as its the exact same as the localhost server? They both have utf8mb4_unicode_ci set up on all tables.

SOLUTION:

Cannot post this as an answer since this question was closed as a duplicate. However, for anyone else who has this problem the below fixed it for me. It wasn't related to the database. The wp-config.php needed updating. I changed define('DB_CHARSET', 'utf8mb4'); to define('DB_CHARSET', 'utf8');

1条回答
你好瞎i
2楼-- · 2019-06-14 10:16

These issues usually come from the database collation type. Change it to one that supports UTF-8. And make sure you select as UTF-8.

In mysql this is usually done with SET NAMES utf8 or provide the options in PDO.

Since there is no code showing how this page is printed I cannot add in a solution.

查看更多
登录 后发表回答