0

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');

Sparky
  • 98,165
  • 25
  • 199
  • 285
probablybest
  • 1,403
  • 2
  • 24
  • 47
  • 1
    For anyone who's having this same issue by changing the wp-config file from define('DB_CHARSET', 'utf8mb4'); to define('DB_CHARSET', 'utf8'); it fixed the issue. – probablybest Feb 27 '16 at 15:39
  • For the benefit of anyone else having the same problem, rather than putting the solution in the question, please post the solution below as an answer and the "accept" it. Thanks. – Sparky Feb 27 '16 at 15:51
  • Unable to put it as an answer as I would have done.If the duplicate is removed I will be able to answer it. – probablybest Feb 27 '16 at 15:52
  • @Sparky I closed the question. If I should reopen, let me know and if this was a bad closed. However, the duplicate does seem to answer it. Yet, I did post this as a community wiki http://stackoverflow.com/a/35671835/1415724 – Funk Forty Niner Feb 27 '16 at 15:54
  • @Fred-ii-, ok, I did not see it closed as duplicate until I refreshed the page. Yes, the duplicate seems to cover it. – Sparky Feb 27 '16 at 15:56
  • @Sparky I just noticed a vote to reopen. I don't know who did, but I don't think I should reopen at this point. If a moderator feels it should be, then I'll let them decide. I don't know where to throw myself here lol – Funk Forty Niner Feb 27 '16 at 15:59
  • @Fred-ii-, I voted to re-open *before* you posted your first comment. I'm not allowed to retract my vote or I would. The duplicate seems to cover this, so leave it closed. – Sparky Feb 27 '16 at 16:01
  • @Sparky No worries. If a moderator sees it, we'll just *"leave well enough alone"* for now, and see what comes of it. *Cheers* and thanks for the additional edit to the OP's question. There's enough now to inform others who may be faced with the same or similar problem. – Funk Forty Niner Feb 27 '16 at 16:02

1 Answers1

0

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.

Xorifelse
  • 7,878
  • 1
  • 27
  • 38