WordPress Charset Encoding Problem After Upgrading to Version 2.2

WordPress blogs that upgraded to Wordpress version 2.2 may encounter strange character set (charset) encoding problem where several characters especially apostrophes (‘), quotation marks (“), and hyphens or dashes (—) are displayed as strange characters such as ’ or simply as question marks (?) when the posts are output to web pages. As you have probably suspected, the issue is caused by character encoding method used by WordPress 2.2 which supports setting of database collation and character set in WordPress config file.

The error happens because up to and including WordPress ver 2.1.3, almost all WordPress databases were created using the latin1 character set and the latin1_swedish_ci collation. Beginning WordPress v2.2, WordPress allows the user to define both the database character set and the collation in wp-config.php file, using DB_CHARSET and DB_COLLATE values. With these values set to another encoding, WordPress assumes that the databases are indeed using the charset and collation too, where it’s not the case for existing WordPress installation. So if you’re upgrading WordPress to 2.2 using the default wp-config.php, or have manually modified the file to include the new variables, or upgrading by using Fantastico which automatically update the wp-config.php file to include these two definitions which values set as Unicode UTF-8 by default, you will need to remove these definitions to solve the character encoding error.

Open and edit your WordPress wp-config.php file. Then locate the following two lines:

define(‘DB_CHARSET’, ‘utf8′);
define(‘DB_COLLATE’, ”);

You can simply delete these 2 lines away, or just remove the utf8 from the first line to make them looks like this:

define(‘DB_CHARSET’, ”);
define(‘DB_COLLATE’, ”);

With no charset and collation values set, WordPress will fall back to the old default, latin1 which matched the databases.

A possible better solution is convert the Wordpress database to UTF8 Unicode.

43 Responses to “WordPress Charset Encoding Problem After Upgrading to Version 2.2”

Pages: 1 2

  1. Gonzalo
    December 14th, 2009 22:44
    43

    HELP!!!

    I am using WP latest version, with Exec-php plugin (to run php code) and TTF plugin (to convert text with any font to images).
    My fonts has all special chars but whenever I enter á é í etc it is replaced by a box.

    I’m using UTF-8 for posts, is there any extra config I should take into account?

    Thanks in advance!

  2. Nick McCormick
    November 15th, 2009 05:33
    42

    I never look forward to a Wordpress upgrade. Seems there is always a glitch of some sort. Your post helped me quickly fix this one.

    Thanks very much.

  3. catalonia blog
    November 11th, 2009 16:54
    41

    I had a similar problem with a wp update but sorted it out alright. Think I did the update the wp database to UTF8 Unicode.

  4. Snigel.nu – Olle Linge » WordPress updated to version 2.8
    July 4th, 2009 05:18
    40

    [...] Update: Chinese and Swedish alike should be displayed properly now. The problem arises when converting to new versions of WorpPress, but by changing a few parameters, it’s possible to let WordPress revert to the old way of handling charactersets. The solution to the problem can be found here. [...]

  5. babysitter
    May 3rd, 2009 11:20
    39

    I solved following these steps:
    http://www.levysoft.it/archivio/2007/07/06/risolvere-il-problema-della-visualizzazione-errata-dei-caratteri-accentati-su-wordpress-cambiando-il-charset-da-iso-8859-a-utf-8/

  6. RaiulBaztepo
    March 29th, 2009 05:14
    38

    Hello!
    Very Interesting post! Thank you for such interesting resource!
    PS: Sorry for my bad english, I’v just started to learn this language ;)
    See you!
    Your, Raiul Baztepo

  7. Marek
    January 31st, 2009 02:33
    37

    Thank you a lot! It worked out perfectly. Now, I have to convert everything to UTF8.

  8. مشاكل الترميز Encoding في Wordpress 2.2 بعد الترقية | سوالف حسن
    December 23rd, 2008 12:49
    36

    [...] WordPress Charset Encoding Problem After Upgrading to Version 2.2 اقرأ المزيد عن …أهلا 2.5، ومرة أخرى مشكلة الترميز بحمدالله تم الانتقال إلى النسخة الحديثة 2.5 من ووردبريس، وكل…ما الجديد! تم اصدار نسخة جديدة من برنامج ووردبريس، وكما ذكر في…WYSI-Wordpress محرر نصوص متقدم Wysi-Wordpress محرر تنسيق المدونات لمن يريد اختيارات أكثر و حرية… [...]

  9. Tommy
    October 17th, 2008 13:15
    35

    Thank you for this post!

  10. Fix odd characters in Wordpress posts | Chris Fay & Jennie Fay’s Webportal
    September 16th, 2008 10:05
    34

    [...] caused due to the encoding and collation, however after following the recommendations of sites like http://www.mydigitallife.info/2007/0…to-version-22/ I was still unable to get rid of the huge amount of garbled characters. Ultimately, I spent some [...]

  11. Paula G
    September 6th, 2008 19:50
    33

    Thanks so much — you saved me hours of hair pulling!

  12. Ates Goral
    August 24th, 2008 11:20
    32

    Thanks! Saved me a lot of time.

  13. Rodrigo
    August 23rd, 2008 05:24
    31

    thanks

  14. Endolith
    June 18th, 2008 08:42
    30

    Isn’t UTF8 much better? Why would you limit yourself to Latin1 just because it used to be the default?

  15. Tom Clarke
    June 6th, 2008 20:56
    29

    Just wanted to say: this had afflicted me for months. Never found a workable solution. Stumbled on your site today and it worked perfectly. Thanks so much!

  16. Josh
    February 19th, 2008 05:04
    28

    Hi, thanks for doing this. it’s the only thing I’ve found. I remove the utf8 and a lot of my posts still have the question marks. any ideas what I may need to do?

  17. Marthin
    February 17th, 2008 03:44
    27

    thanks for the help, it worked out for me :)

  18. Bruno Silva
    January 5th, 2008 06:55
    26

    Thx a lot!
    You saved me hours!

Pages: 1 2

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to My Digital Life Comments RSS feed to receive notification of latest comments posted.

New Articles

Incoming Search Terms for the Article

wordpress encoding - wordpress charset - wordpress character encoding - wordpress encoding problem - charset wordpress - wordpress RSS encoding - wordpress charset problem - wordpress DB_CHARSET - wordpress database encoding - wordpress html encode - wordpress change encoding - encode wordpress - change wordpress encoding - wordpress utf-8 encoding - wordpress character problem - wordpress encode - wordpress charset encoding - wordpress unicode problem - WordPress Weird Characters - wordpress encoding problems - set charset in wordpress - wordpress db_collate - wordpress text encoding - character encoding wordpress - wordpress utf-8 problem - wordpress html encoding - change encoding wordpress - wordpress character set - wordpress default encoding - wordpress utf-8 - wordpress apostrophe problem - charset in wordpress - strange characters wordpress - latin1_swedish_ci wordpress - wordpress blog charset - wordpress encode title - wordpress encoding settings - encoding wordpress - wordpress title problem - html encode wordpress - wordpress polish characters - wordpress arabic encoding - apostrophe in wordpress email address - wordpress utf8 - ترميز الوورد - wordpress upgrade encoding problem - wordpress upgrade utf8 - wordpress character - حل مشكلة ترميز الوورد - encoding problems wordpress -