WordPress 2.9.x upgrade causes weird characters on blog

I recently upgraded a number of blogs from WordPress 2.0.11 version to 2.9.1. It all went smoothly except that the upgrade apparently converted certain characters in posts and comments to weird characters. The gobbledygook kind.

If you have the ability to download your database (here's the harder version of getting a mysqldump, which is much easier if you have phpMyAdmin), I'd suggest downloading only the wp_posts and wp_comments tables. Then copy them. Then edit them. (Too many copies are better than none.)

Remember: these are just instructions on the Internet; I'm not there, you're not hiring me, and I make no promises. In essence, you're on your own. Especially if you fail to make backup copies! If you really don't know what you're doing, I suggest getting someone to help you who's familiar with this kind of thing because, if you mess up your database, you've lost the entire contents of your blog.

How to download your WordPress Database

  1. In your web hosting account, go to phpMyAdmin (if your web hosting account has cPanel, you'll have to log in there first, then click the phpMyAdmin icon).
  2. In phpMyAdmin, if you only have one database, you'll probably see a page listing your WordPress database tables next. If you have more than one, select the WordPress database; then you'll see the individual tables.
  3. Click the name of your database (it's above the list of tables).
  4. Click Export
  5. In the little "Export" box, click Unselect All — then select the individual table you want to download (I'd recommend doing these one at a time):

    – wp_posts
    – wp_comments

    When you back up the second file, DO NOT OVERWRITE the first one on your computer — rename it instead.

  6. Near the bottom of the page, select Save as File, and click Go.

    A window will pop up prompting you to save the file to your computer. When you export the second table (e.g., wp_comments), phpMyAdmin will probably name the file the same thing as the first one; change the file name, so you don't overwrite the first file.

  7. VITAL — NOW BACK UP YOUR ENTIRE DATABASE: repeat steps 5-6 but, in the Export box, click Select All, then check Save as File and press Go. When you save the file, DO NOT OVERWRITE the earlier files you downloaded. This is your entire database — all posts, comments, preferences, everything. It's a good idea to do this on occasion.

Editing the database tables

Open your database table in a text editor such as NoteTab or <gulp> Windows' Note Pad (which I find horrifically difficult to read). Here are some of the replacements:

Weird Character Should Be Replace in Database with:
“ " & q u o t ;
” " & q u o t ;
– [three hyphens]*
’ ' " [two apostrophes]**

* WordPress will convert the three hyphens to an emdash (a long dash).

** That last one — the two apostrophes — is vital. If you replace ’ with one apostrophe only, while it may look correct to you as you read through your database tables, you'll have problems when you import your edited tables back into the database. Trust me on this one; it just won't work.

Importing the tables into your database

This is somewhat the reverse of exporting your database, with the exception of one thing: you'll be emptying (deleting) the contents of the two tables before you import them.

  1. Go to phpMyAdmin.
  2. Click the name of your database
  3. Check the name of the first table (e.g., wp_posts)
  4. In the dropdown box below that where it says "With Selected"), select Empty.
    (This will delete the contents of that table, which is what makes the backups you previously made vital.)
  5. Click Go. This empties the table.
  6. Now, click Import.
  7. On the Import page where it says "File to import", click the Choose button, maneuver to the file on your computer, select it, and click Open.
  8. Click Go.

If all goes well, you'll get a message saying so. If it doesn't, you'll get a message stating that there have been errors. If this happens, and if you're not able to fix it, empty that particular table again (#3-5 above) and then import the unedited copy of the table. Better to have posts and comments with strange characters in them than to have none at all. :)


Lastly, if you're using a word processor such as Microsoft Word to type your posts before cutting/pasting them into WordPress, you're going to get weird characters anyway — without upgrading WordPress. Here's an article I wrote about configuring Word to help make those little problems go away: Microsoft Word making weird characters in your blog or email?

2 Comments to "WordPress 2.9.x upgrade causes weird characters on blog"

  1. Paul says:

    Hi Diane

    I really like the look of your site, is this a wordpress site and if so is the theme your own or is it available to all.



  2. Diane Vigil says:

    Thanks for the compliment. Yes, the site uses WordPress, and I created the theme ages ago. :)

Have your say ...

First-time comments will be held for moderation (but comments are appreciated). Otherwise, just be courteous. If your name is a bunch of keywords, your comment will be deleted. Don't post links unless highly pertinent. Posters must be 16 or older.

Manage your subscriptions

© 2004-2019 DianeV Web Design Studio. All Rights Reserved.
28 queries. 0.217 seconds.