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.

Share and contribute or get technical support and help at My Digital Life Forums.



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

Pages: « 2 [1] Show All

  1. Back on track! | isa costa * the geek side
    November 19th, 2007 03:31
    25

    [...] de upgrade (localizado em wp-admin/upgrade.php), os posts apareciam com os acentos todos marados. A solução mais rápida é editar o ficheiro wp-config.php e deixar os valores das constantes DB_CHARSET e [...]

  2. cgb
    October 27th, 2007 03:18
    24

    thanks!

  3. morgan
    October 21st, 2007 09:39
    23

    Thank you so much for this. It fixed the error.

  4. Marco Polci » Blog Archive » Wordpress e set di caratteri
    September 19th, 2007 20:10
    22

    [...] questo post viene spiegato il problema e presentata una soluzione. In realtà nel mio caso il problema sembra [...]

  5. WordPress Line Break Problem | W-Shadow.com
    September 15th, 2007 01:59
    21

    [...] also applied a charset encoding hack to my wp-config.php. All this combined solved my line break problem. Share and Enjoy: These icons [...]

  6. Websitetology » WordPress displaying odd characters?
    August 31st, 2007 03:18
    20

    [...] this excellent article will give you the answers you need to your broken WordPress install: WordPress Charset Encoding Problem After Upgrading to Version 2.2 » My Digital Life WordPress blogs that upgraded to Wordpress version 2.2 may encounter strange character set [...]

  7. Small Frame Code
    August 31st, 2007 03:14
    19

    [...] You can read more about the problem, and the solution, at MyDigitalLife. [...]

  8. Vladimir
    August 30th, 2007 08:48
    18

    Thanks a lot! It works! :)

  9. Mark’s (we)Blog » Mark’s (we)Blog 2.0
    August 30th, 2007 04:37
    17

    [...] fixed that issue (commenting out define(’DB_CHARSET’, ‘utf8′); and define(’DB_COLLATE’, ”);) - further explanation of this fix can be found at My Digital Life although I haven’t been brave enough to convert the character set and collation [...]

  10. Pelles Blog » Arkiv » S� har man uppdaterat
    August 13th, 2007 03:23
    16

    [...] Editerat: Nu hittade jag vad det handlade om, om du råkat ut för samma sak, kolla här. [...]

  11. curo.dk » Blog Archive » Updated site
    August 11th, 2007 22:31
    15

    [...] found something here but it does not seem to work for my [...]

  12. sandstorm » Blog Archive » Problemino aggiornando WP alla 2.2.1 e nuova grafica
    July 29th, 2007 04:24
    14

    [...] trovato in particolare questo ottimo post che mi ha permesso risolvere il problema in 5 secondi, è bastato modificare un parametro nel file [...]

  13. Wrong charset when upgrading wordpress to 2.2 : Just a blog thingie
    July 24th, 2007 20:46
    13

    [...] Long version can be found at this site [...]

  14. colin
    July 17th, 2007 13:55
    12

    You are awesome. We need more people like you here on Earth.

  15. commadot.com » Blog Archive » Fantastico Upgrade of WordPress
    July 14th, 2007 10:26
    11

    [...] was panicking when I saw that my database had these characters EVERYWHERE.  Then I found this great article on the subject. It clearly states how to fix the problem.  Thank goodness.  I was totally going to make things [...]

  16. iHassan.com
    July 11th, 2007 06:23
    10

    [...] WordPress Charset Encoding Problem After Upgrading to Version 2.2 [...]

  17. Kryptoblog » Blog Archive » Wordpressuppdatering och åäö
    July 2nd, 2007 21:26
    9

    [...] 2007-07-02) Josef tipsade om den här länken. Lite fix med ftp senare så är vi nästan tillbaka på banan [...]

  18. Messier Hunter
    July 2nd, 2007 04:00
    8

    God Bless You, Man!!!

  19. AvengerBR » Update para o Wordpress 2.2 x Erros de Acentua
    June 29th, 2007 06:57
    7

    [...] posts, mas como tenho mais 3 blogs isso era um problema. Dando uma procurada no Google, achei este post que resolveu isso. A solu

  20. Pablo Rosales
    June 27th, 2007 22:31
    6

    Thanks!! You save my blog :D

  21. Greg
    June 27th, 2007 09:16
    5

    Man, thank you, don’t know why I didn’t think of that before - I has going insane - appreciate it.

  22. WooHoo
    June 24th, 2007 23:54
    4

    Awesome, thanks so much!

  23. ckunte.com | UTF-8 and Wordpress 2.x
    June 24th, 2007 19:40
    3

    [...] My Digital Life explains in detail about the problem I experienced (see also the Trac and the Codex) and a (temporary) workaround—this worked for me, by the way. But if you’re not a fan of latin1 character set and associated latin1_swedish_ci collation, then I’d recommend this UTF-8 database converter plugin. Run once, it’s painless—this worked for me too, except for non-english characters (like if you used the caret ones natively in posts and or pages). [...]

  24. How to Convert Character Set and Collation of WordPress Database » My Digital Life
    June 23rd, 2007 03:36
    2

    [...] Since WordPress 2.2, WordPress supports feature that allows the user to define both the WordPress database character set and collation with DB_CHARSET and DB_COLLATE values in wp-config.php file. With these values defined, WordPress will use the designated database characterset (charset) and database collation (i.e. sort order of the letters, numbers, and symbols of a character set) when connecting a database tables. However, in existing WordPress installations that are upgraded from earlier version of WordPress or not explicitly set a Unicode UTF-8 charset collation, the default database character set is normally set up as Latin1 (default on almost all MySQL installation) with latin1_swedish_ci collation. If you run a bilingual or multilingual blog with WordPress, you may face problem on character encoding when your blog posts are written in other foreign languages, or when you export and backup the database and later attempt to re-import the database dump in the event of database failure or server migration and moving. The symptom is obvious, your WordPress posts or pages will contains garbled, weird and funny characters, sometime just lots of ????? (question marks), rendering the WordPress database with your hard work useless and output unreadable. (May cause also by wrong charset collation) [...]

  25. pigduck
    June 19th, 2007 22:35
    1

    Thank you lifesaver!

Pages: « 2 [1] Show All

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 without commenting


Custom Search

New Articles

Incoming Search Terms for the Article

wordpress encoding - wordpress utf-8 - wordpress utf8 - wordpress db_charset - wordpress charset - charset wordpress - wordpress Äú quotation marks - wordpress upgrade character encoding - wordpress encoding issue - encoding wordpress - symantec encoding problem - wordpress encoding problem - wordpress "utf8" - wordpress database upgrade 2.6 problems latin1 2.1.3 - wordpress charset change - wordpress problem after upgrade funny characters - web problem sa charset - utf 8-unicode-ci+wordpress - Wordpress safari utf-8 - tomcat turkish character encoding - weird A character's everywhere wordpress - wordpress +safari +latin1 - wordpress mail encoding - internet explorer 8 arabic encoding problem - symantec endpoint encoding issues - wordpress+change encoding - db_charset db_Collate archive - db_collate wordpress - how encode wordpress password - wordpress change encoding - wordpress database utf8 - wordpress rss encoding change - wordpress utf-8 weird symbols - encodage apostrophes wordpress - encode charsets %20 + - encoding utf-8 wordpress - using hyphen problem word press title - wordpress comment out define('DB_CHARSET', 'utf8') - wordpress after upgrade czech coding - hack wordpress locked post - how to hack wordpress locked post - svensk charset - wordpress utf-8 not working - wordpress encoding settings - wordpress upgrade character encoding - arabic encoding blackberry - Encoding for pages and feeds greek wordpress - mysql 4 DB_CHARSET wordpress - opera charset config - wordpress+change charset -