• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Tips and Tricks HQ

  • Home
  • Projects
    • All Projects
    • Simple WP Shopping Cart
    • WP Express Checkout Plugin
    • Accept Stripe Payments
    • WP Download Monitor
    • Easy HTTPS Redirection
    • WP Security and Firewall Plugin
    • WP eStore Plugin
    • WP Affiliate Platform
    • WP eMember
  • Products
    • All Products
    • Checkout
  • Support
    • Support Portal
    • Customer Only Forum
    • WP eStore Documentation
    • WP Affiliate Software Documentation
    • WP eMember Documentation
  • Contact

How to Fix the Character Encoding Problem in WordPress

Home » Blog » How to Fix the Character Encoding Problem in WordPress

Last updated: July 11, 2016





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:

special-char-example

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.



code-encoding-icon-275

Fixing the Character Encoding Mismatch Problem in WordPress

Step 1) 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).

Step 2) Find the following two lines and comment them out:

define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');

They should look like the following after you comment them out:

//define('DB_CHARSET', 'utf8');
//define('DB_COLLATE', '');

Step 3) Now upload the updated ‘wp-config.php’ file to your webhost (overwriting the old one).

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.

Related Posts

  • How to Install WordPress on Your Domain
  • How to Add Widgets to WordPress Theme’s Footer
  • How to Uninstall and Reinstall WordPress
  • What Would You Do If Somehow You Lost all Your Blog’s Content?

Wordpress Web Development,  web masters,  Wordpress,  Wordpress install,  WordPress Tweaks

Reader Interactions

Comments (25 responses)

  1. kentaro says:
    July 27, 2017 at 12:24 pm

    Cheers mate!

    Just worked like a charm

  2. Jesse says:
    April 12, 2017 at 1:16 pm

    I’m getting a similar error “Malformed UTF-8 characters, possibly incorrectly encoded” when creating a form and unfortunately this didn’t fix it. I guess this is a different issue.

  3. Gwendal Bello says:
    January 18, 2017 at 8:11 pm

    Thank you so much 😀
    I had this problem on few websites and you just saved me hours of work.

  4. sadeer says:
    September 2, 2016 at 9:08 am

    I don’t know how I can kiss you, you just saved my life thank you very much man I had a minor heart attack after thousands of records went to rubbish I love you god bless you

  5. Aly says:
    June 15, 2016 at 2:58 am

    THANK YOU. People kept telling me it was a propagation problem but I knew it wasn’t. 🙂 !!

  6. Myrthe says:
    April 26, 2014 at 8:51 pm

    youre my hero! Thanks a lot!

  7. Bart says:
    May 15, 2013 at 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!

  8. Antonio says:
    December 13, 2012 at 6:09 pm

    This trick, help us a lot and save us 4 hours of work!
    Thanks!

  9. Rahul says:
    May 23, 2012 at 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

  10. Keith Hennessey says:
    April 16, 2012 at 1:49 pm

    This worked like a charm. Thank you!

  11. Dave says:
    January 25, 2012 at 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.

  12. Vitaliy says:
    December 22, 2011 at 6:20 pm

    Thank you for saving me a TON of time. This helped me out after a DB restoration,

  13. Raphael Oliveira says:
    November 4, 2011 at 2:55 pm

    You´ve just saved my blog! Transfered to another server. Thank you.

  14. Dragan Đermanović says:
    August 17, 2011 at 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!!!

  15. Charlotte Coleman says:
    April 12, 2011 at 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!

  16. Technology Resources says:
    February 17, 2011 at 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.

  17. tisa3com says:
    February 1, 2011 at 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

  18. Jessi says:
    January 13, 2011 at 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!

  19. Jesper Wilfing says:
    May 24, 2010 at 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

  20. Jesper says:
    May 19, 2010 at 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

  21. admin says:
    July 16, 2009 at 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.

  22. Charles says:
    July 16, 2009 at 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

  23. George Serradinho says:
    July 6, 2009 at 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Featured & Popular Articles

Video Answers to Top WordPress QuestionsWordPress Optimization Tips and Tricks for Better Performance and SpeedEssential WordPress Security Tips - Is Your Blog Protected?WordPress Simple PayPal Shopping Cart PluginTop 15 Search Engine Optimization (SEO) Techniques I Forget to DoList of the Best and Must Use WordPress PluginsHow do I Start a Blog and Make Money Online?Good Domain Name Picking Tips for Your Blog SetupFind Out Which WordPress Web Hosting Company Offers the Cheapest and Reliable Web Hosting Solution

Featured WordPress Plugins

WP Express Checkout Plugin
wordpress estore plugin
wordpress membership plugin
wordpress affiliate plugin

Recent Posts

  • How to Use Browser Developer Tools to Inspect Elements and [...]
  • Accept Donations via PayPal from Your WordPress Site Easil [...]
  • Buy Now Button Graphics for eCommerce Websites [...]
  • Subscription Button Graphics for eCommerce Websites [...]
  • Adding PayPal Payment Buttons to Your WordPress Sidebar Ea [...]

Comment & Socialize

  • @Rob, We have just released ...
    - admin
  • I installed the plugin a co ...
    - Rob
  • @Sebastian, We've released ...
    - admin
  • I've used this plugin on a ...
    - Sebastian Djupsjöbacka
  • @John, this plugin doesn't ...
    - admin

Check out our solutions

View our WordPress plugin collection and start using them on your site.

Our WordPress Solutions

Footer

Company

  • About
  • Privacy Policy
  • Terms and Conditions
  • Affiliate Login

Top WordPress Plugins

  • Simple Shopping Cart
  • PayPal Donations
  • WP Express Checkout
  • WP eStore
  • WP eMember

Blogging Tips

  • How to Start a Blog
  • Selecting a Good Domain
  • Cheap WP Hosting
  • WP Video Tutorials
  • Simple SEO Tips

Search


Keep In Touch

Copyright © 2025 | Tips and Tricks HQ