• Resolved shadez

    (@shadez)


    New characters got injected into my wp-posts table. I was able to remove all except  who is quite adamant to stay. this is the query i used:
    UPDATE wp_posts SET post_content = REPLACE(post_content, 'Â', '');
    guess its a silly mistake. my sql skills are below novice levels.
    please advice.

    background:
    just in case you need to know, i made changes to my old wp-config file for enabling multisite. i did NOT specify DB_CHARSET and DB_COLLATE in it, which wasnt present earlier either. but still the encoding got messed up somehow. i ran this bunch of code and all of the strange characters got removed, except  ofcourse:

    UPDATE wp_posts SET post_content = REPLACE(post_content, '“', '“');
    UPDATE wp_posts SET post_content = REPLACE(post_content, '”', '”');
    UPDATE wp_posts SET post_content = REPLACE(post_content, '’', '’');
    UPDATE wp_posts SET post_content = REPLACE(post_content, '‘', '‘');
    UPDATE wp_posts SET post_content = REPLACE(post_content, '—', '–');
    UPDATE wp_posts SET post_content = REPLACE(post_content, '–', '—');
    UPDATE wp_posts SET post_content = REPLACE(post_content, '•', '-');
    UPDATE wp_posts SET post_content = REPLACE(post_content, '…', '…');
    UPDATE wp_comments SET comment_content = REPLACE(comment_content, '“', '“');
    UPDATE wp_comments SET comment_content = REPLACE(comment_content, '”', '”');
    UPDATE wp_comments SET comment_content = REPLACE(comment_content, '’', '’');
    UPDATE wp_comments SET comment_content = REPLACE(comment_content, '‘', '‘');
    UPDATE wp_comments SET comment_content = REPLACE(comment_content, '—', '–');
    UPDATE wp_comments SET comment_content = REPLACE(comment_content, '–', '—');
    UPDATE wp_comments SET comment_content = REPLACE(comment_content, '•', '-');
    UPDATE wp_comments SET comment_content = REPLACE(comment_content, '…', '…');

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter shadez

    (@shadez)

    argh, forgive my stupidity.. above query works. i had accidentally put a blankspace in between.

    I am having the exact same issue. Can you please tell me exactly what you did to run that query. I am desperate to fix this issue but I also don’t want to nuke my whole site so I would be grateful for simple and easy to follow instructions.

    Thread Starter shadez

    (@shadez)

    sorry could check back on this thread only now. Looks like you got it solved. So will leave it at that for now. 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘SQL query to remove 'Â' from DB’ is closed to new replies.