• vmurygin

    (@vmurygin)


    I have discovered that some of the older posts on my blog have weird characters in them where usually apostrophes or quotes, etc. should be. For example, won’t instead of won’t.

    Now, I have researched this and found a suggestion that seemed promising, which was to remove these 2 lines from wp_config.php file:

    define(‘DB_CHARSET’, ‘utf8?);
    define(‘DB_COLLATE’=, “);

    When I did that it fixed the problem on the old posts, but now the newer posts started showing weird characters, which is even worse.

    I’m guessing that when my blog was moved something changed, so now it seems posts before July 2009 have one encoding and then posts since that date have another encoding – at least that’s what I’m guessing.

    So is there a way to change the encoding just for posts before certain date (and not for all of them?) or any other solution? I’m not a coding guru, but now some PHP and SQL.

    I also seen this plugin: http://wordpress.org/extend/plugins/utf-8-database-converter/

    but reading the comments they don’t recommend running it on WP older than 2.2, b/c apparently there are reports of it erasing posts after a certain character.

    Any help would be appreciated. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • vtxyzzy

    (@vtxyzzy)

    BACK UP FIRST!!

    One method would be to export the table and use a text editor to clean it up, then re-import.

    If you can get into phpMyAdmin (or a similar tool), you might use a query like this:

    UPDATE wp_posts
    SET post_content = REPLACE(post_content,CHAR(194),'?')
    WHERE ID = 1

    Replace the ‘1’ with the ID of a post that has the problem, the 194 with the decimal value of one of the unwanted characters, and the ? with a single or double quote as needed. Use ‘”‘ to replace with a double quote, and “‘” for a single quote. If that corrects that post, remove the WHERE clause and run against the whole table. Repeat with decimal values for the other characters.

    Did I mention to BACK UP FIRST??

    Thread Starter vmurygin

    (@vmurygin)

    Thanks, I guess I’ll do that. I was hoping there was an easier way. I’m not really sure how many of those weird characters are there. Definitely seems like more than one.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Weird characters on older posts (encoding problem?)’ is closed to new replies.