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.
Related Articles
- How to Convert Character Set and Collation of WordPress Database
- Download Previous or Old Version of WordPress
- How to Customize, Modify or Change WordPress Database Connection Error Page
- Download WordPress 2.3 Release Candidate 1 (RC1) with Tags Support
- Integrate WordPress including Comments with bbPress Forum using bbSync
- WordPress 2.1.1 Critical Security Alert - Download Upgrade to 2.1.2
- Automatically Update WordPress to Latest Version with Automatic Upgrade Plugin (WPAU)
- WordPress 2.6 with Change Revision Tracking Feature Available for Free Download
- Disable Auto Go To (Jump) To Read More Tag
- Paginating or Split WordPress Post or Page with NextPage in WordPress Not Working

































November 19th, 2007 03:31
[...] 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 [...]
October 27th, 2007 03:18
thanks!
October 21st, 2007 09:39
Thank you so much for this. It fixed the error.
September 19th, 2007 20:10
[...] questo post viene spiegato il problema e presentata una soluzione. In realtà nel mio caso il problema sembra [...]
September 15th, 2007 01:59
[...] also applied a charset encoding hack to my wp-config.php. All this combined solved my line break problem. Share and Enjoy: These icons [...]
August 31st, 2007 03:18
[...] 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 [...]
August 31st, 2007 03:14
[...] You can read more about the problem, and the solution, at MyDigitalLife. [...]
August 30th, 2007 08:48
Thanks a lot! It works!
August 30th, 2007 04:37
[...] 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 [...]
August 13th, 2007 03:23
[...] Editerat: Nu hittade jag vad det handlade om, om du råkat ut för samma sak, kolla här. [...]
August 11th, 2007 22:31
[...] found something here but it does not seem to work for my [...]
July 29th, 2007 04:24
[...] trovato in particolare questo ottimo post che mi ha permesso risolvere il problema in 5 secondi, è bastato modificare un parametro nel file [...]
July 24th, 2007 20:46
[...] Long version can be found at this site [...]
July 17th, 2007 13:55
You are awesome. We need more people like you here on Earth.
July 14th, 2007 10:26
[...] 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 [...]
July 11th, 2007 06:23
[...] WordPress Charset Encoding Problem After Upgrading to Version 2.2 [...]
July 2nd, 2007 21:26
[...] 2007-07-02) Josef tipsade om den här länken. Lite fix med ftp senare så är vi nästan tillbaka på banan [...]
July 2nd, 2007 04:00
God Bless You, Man!!!
June 29th, 2007 06:57
[...] posts, mas como tenho mais 3 blogs isso era um problema. Dando uma procurada no Google, achei este post que resolveu isso. A solu
June 27th, 2007 22:31
Thanks!! You save my blog
June 27th, 2007 09:16
Man, thank you, don’t know why I didn’t think of that before - I has going insane - appreciate it.
June 24th, 2007 23:54
Awesome, thanks so much!
June 24th, 2007 19:40
[...] 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). [...]
June 23rd, 2007 03:36
[...] 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) [...]
June 19th, 2007 22:35
Thank you lifesaver!