Wordpress 2.0 Upgrade Problems: Character Encoding + Transformation
The Wordpress 2.0 upgrade.php script in the wp-admin folder is designed to convert older copies of your database from older versions of Wordpress. However, there’s something wrong with the character encoding, or the collation (latin1_swedish_ci). Changing the collation after the fact doesn’t affect the improper characters being passed back, so I assume it would need to be set before migration. Here’s an example of what it looks like:

After the damage has occured, the best way, it seems, to clean this up is to run multiple SQL queries in the phpmyadmin console emulating find/replace on the wp_posts table:
UPDATE wp_posts SET post_content = replace(post_content, "bad", "good")
This has to be done for each character. So far, I’ve noticed apostrophe marks, the left and right quotation marks, all kinds of dashes, and ellipsis are affected.� It’s like it got run through the WP filters before it went back into the database.
It’s weird that my UTF-8 encoding has switched itself over to ISO-8859-1 all by itself…
| This entry was posted on Monday, April 3rd, 2006 at 5:55 pm and is tagged with sql queries, character encoding, collation, ellipsis, utf 8, older versions, dashes, quotation, migration, phpmyadmin, transformation, wp. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback. |



[...] Upgrade Problems: Character Encoding and Transformation [...]
I am trying to verify my wordpress 2.1 and each time when I save a URL with &, it fails the validation. Says I need the & amp ; instead. This is only in the widgets (that are now standard). When I save it, it doesn’t take, and displays again as & and fails validation.
How can I get the & amp ; to stick?
[...] Wordpress 2.0 Upgrade Problems: Character Encoding + Transformation [...]
I have upgraded 3 blogs now to WP2 and had none of these problems… maybe they did something to the code since I last downloaded it but from what I have seen the upgrade works just fine from the last 1.whatever release to 2. Check out the blog I did at blog.overshard.com…. no problems at all… or none I have noticed.