How to Fix the Character Encoding Problem in WordPress
Categories: Wordpress
I recently changed my web hosting again in an attempt to speed up the page load time of my website. I had to do it as the former hosting’s page response time was horrible. It was taking 9 seconds for my home page to load with the former hosting. Now my home page loads under 4 seconds! It’s amazing the difference it makes… now I don’t get angry when browsing my own site (I wonder what my visitors were thinking while waiting for the page to load!).
Anyway, The transfer was smooth but I had a slight issue that I noticed after the transfer. There were special characters similar to the following scattered throughout my blog posts:
![]()
I was pretty sure that this was a character encoding mismatch problem. I got a little scared thinking it would take a long time to fix but then I found a really easy way to solve it.
![]()
Fixing the Character Encoding Mismatch Problem in WordPress
- Open the ‘wp-config.php’ file in a text editor such as notepad (the wp-config.php file can be found on the directory where you installed WordPress).
- Find the following two lines and comment them out:
define(‘DB_COLLATE’, ”);
They should look like the following after you comment them out:
//define(‘DB_COLLATE’, ”);
- Now upload the updated ‘wp-config.php’ file to your webhost.
This character encoding problem can happen after a database upgrade too so it doesn’t hurt to keep this trick in your mind just in case.






#1 by Bart on May 15, 2013 - 3:25 am
Thanks alot for this tip; it helped me resolve the issue where WP sort of “deletes” all content after using special characters. This tip saved me a lot of work and searching, since it supposedly also had something to do with PHP settings of my host who wasn’t able to change this. Thanks!
#2 by Antonio on December 13, 2012 - 6:09 pm
This trick, help us a lot and save us 4 hours of work!
Thanks!
#3 by Rahul on May 23, 2012 - 2:52 am
Thanks a lot, i was not able to save posts in admin, they were just saving half till some special character or double space, it worked like a wonder, thank a lot
#4 by Keith Hennessey on April 16, 2012 - 1:49 pm
This worked like a charm. Thank you!
#5 by Dave on January 25, 2012 - 1:35 pm
THANK YOU! We actually needed to ADD “define( ‘DB_CHARSET’, ‘utf8′);” IN on the wp-config file when we had this issue moving from Dreamhost to Hostgator. But it worked like a charm on a 500+ page website. This literally saved us dozens of hours.
#6 by Vitaliy on December 22, 2011 - 6:20 pm
Thank you for saving me a TON of time. This helped me out after a DB restoration,
#7 by Raphael Oliveira on November 4, 2011 - 2:55 pm
You´ve just saved my blog! Transfered to another server. Thank you.
#8 by Dragan Đermanović on August 17, 2011 - 7:21 pm
I had similar problem during some plugin fixing but unfortunately this was not solution for my problem.
Apparently it was not up to db charset/collation but symptoms were just the same…
BUT (in case someone is in the same jam):
have opened file in Dreamweaver –> checked out if encoding is unicode utf-8, ok –> Save As with checked “Include Unicode Signature (BOM)” in the Save As dialog and ta-daaa!!!
#9 by Charlotte Coleman on April 12, 2011 - 12:24 pm
Thanks a lot – this issue has been investigated by the hosting company for 3 weeks to no avail. I thought I’d take a quick look myself and found your post. Really helpful!
#10 by Technology Resources on February 17, 2011 - 2:53 am
Awesome man,You have saved me from getting fired. I have been struggling with this character encoding problem since many days. Thanks alot.
#11 by location voiture Casablanca on February 1, 2011 - 9:45 pm
thank you very much for this soluttion, but i find only line :
define(‘DB_CHARSET’, ‘utf8′);
and i remplaces with
define(‘DB_CHARSET’, ‘utf8′);
and that’s work ^^
thank you
#12 by Jessi on January 13, 2011 - 5:43 am
THANK YOU!!!!!!!!!!!!!!!! I’ve been struggling with this for over a year with one of my wordpress sites and your post is the first and only simple solution….that worked! Thank you so much!
#13 by Jesper Wilfing on May 24, 2010 - 4:36 am
Aight.. I managed to solve this by changing the coding of the PHP pages themself with notepad++:
http://wordpress.org/support/topic/401149?replies=2
#14 by Jesper on May 19, 2010 - 3:54 am
Arghh.. it didn’t help me… I still gret ����� characters instead of É´å ä ö … Really anoying. Any ideas? Source of the text is both from database and from pages.
/Jesper
#15 by admin on July 16, 2009 - 8:36 pm
Hi Charles, I switched to InMotion Hosting. Yeah so far I am happy with them. I really hate it when a webhosting company puts you on an overpopulated server and your site runs like a dog.
#16 by Charles on July 16, 2009 - 1:28 pm
What web host did you switch to?
Your site is indeed faster now and I’m sure the web host plays a role.
best,
Charles
#17 by George Serradinho on July 6, 2009 - 10:41 am
I had that once when I backed up my database and then had to reload it as it was corrupt. At that stage I had a few posts so I actually ended up edit the posts one by one.
I will remember this tip if it happens again.