Cleaning Up Unicode Cruft in WordPress

While helping someone with WordPress move earlier this week, I noticed a bunch of weird Unicode cruft (like ’ and –) in their posts and comments. Apparently, MySQL databases don’t like it when you switch their default character encoding. But different web hosts have different ways of doing things — so default character encodings can (and sometimes do) change while you’re moving a site around.

Anyhow, after a bit of digging, I found a really handy set of MySQL commands that fixed things up. But I like to save time, so I made myself a Gist for future use and decided to share it with y’all…

Hopefully someone else out there finds this useful! I know I’ll probably use it at least once or twice a week now that I’m doing a lot more work with MySQL imports.

Good luck!