RKG Logo 434-978-4300

A mysql upgrade scrambled quote characters across this blog. This technical post explains the fix. Warning — off-topic post follows! Not a marketing post.


If you’re still reading at this point, perhaps you found this post via search and perhaps you’re trying to fix scrambled quote characters in your blog. Welcome. When we upgraded our mysql database powering this blog last week, the open and close single and double quote characters turned to mush. At first we though the issue was in the WordPress level. After discovering the problem was in the database, we found a helpful post by Derek Sivers over at ORielly’s OnLamp (Turning MySQL data in latin1 to utf8 utf-8) which provided the solution. First, make sure your problem is in your database, not in your WordPress. Second, confirm these hex encodings are correct for your situation by following Derek’s advice. And third, back up your database before issuing these updates as they’re irreversible. These queries worked for us:


/* fix open double quote  */
 update wp_posts set post_content=replace(post_content,
unhex('C3A2E282ACC593'), '"')
where post_content regexp unhex('C3A2E282ACC593');
/* fix close double quote  */
 update wp_posts set post_content=replace(post_content,
unhex('C3A2E282ACC29D'), '"')
where post_content regexp unhex('C3A2E282ACC29D');
/* fix open single quote  */
 update wp_posts set post_content=replace(post_content,
unhex('C3A2E282ACCB9C'), '\'')
where post_content regexp unhex('C3A2E282ACCB9C');
/* fix close single quote */
 update wp_posts set post_content=replace(post_content,
unhex('C3A2E282ACE284A2'), '\'')
where post_content regexp unhex('C3A2E282ACE284A2');

The query stream we used to find Derek’s post:

  • “wordpress quotes”
  • “wordpress quotes smart”
  • “strange quote character wordpress”
  • “wordpress set bloginfo charset”
  • “post charset wordpress”
  • “wordpress charset”
  • “malfunctioning quotes wordpress”
  • “wptexturize”
  • “wordpress character quotes in database”
  • “mysql smart quotes”
  • “mysql utf upgrade”
  • “mysql quote characters upgrade”


Technorati Tags: ,

If you like this post, consider subscribing to our RSS feed. You can also have new posts sent to you via email.


Related Posts

    No related posts.

Comments

  1. Anna-marie, April 16, 2007:

    Thanks – I found I had a few more to do on one web, some more variations on quotes, dashes etc as the post title’s and names. I have put the SQL code on my web if anyone needs more. See http://www.anmari.com/anmari/2007/04/strange-characters/

  2. David Radovanovic, January 10, 2009:

    Thanks!! In my case, I wondered if the problem was language encoding.

  3. Anonymous, February 10, 2009:

    I’m not a fan of the smart-quote (“’”) appearing in an RSS entry at all, at least not for the next several years until technology generally improves around handling of encoding/fonts. It seems to be source of problems in the consumption and display of feeds, and isn’t necessary. The author, editor, or application could convert it to a single quote (“‘”) and no content would be lost.

  4. Michelle, September 6, 2009:

    Thanks for posting this. The post may be old, but the information was good and it REALLY helped when converting from one blog software to another.

    Appreciate it!

  5. Specters, October 16, 2009:

    There is a plugin for this, make sure you backup your database because its for old wordpress but it still works for me as of 2.8

    http://wordpress.org/extend/plugins/utf-8-database-converter/

Your Comment

Tags

RKG Tags: ,

Technorati Tags: ,

Trackback

http://www.rimmkaufman.com/rkgblog/2007/01/04/fixing-smart-quotes-in-wordpress/trackback/

Email Updates

Categories

Recent Comments

  • Mark Ballard: Cory, I don’t see this as an SEO v. PPC issue. The core of my argument is that CTRs are lower primarily due to misleading...
  • Cory Grassell: What are your thoughts on stats that suggest consumers are more apt to click on organic search results than PPC results? As a...
  • George Michie: Kevin, Marc, thanks for your comments. Help is coming, but not the solution. There are a number of instances when the CTR on the...
  • Marc Adelman: George, You have been an advocate of “the advanced control option” for years now. Depressing right YEARS! Eh…listen...
  • Kevin Hill: Is what they really need is a fourth match type. Here’s google’s help documentation on broad match: This is the default...
  • Kevin Micalizzi, Dimdim Web Conferencing: Jim (& George)- We still offer a free version of Dimdim. Just click Sign Up Now at the top of the...
  • Tomas: indeed, i can’t talk about it either… :)
  • Philip Price: Thank you for the RegHack, it worked for me, tho at first when i made the reg file with the information i copied from above i also...
  • George Michie: Sorry Jim, this post was written in 2007. Apparently some of those products are gone.
  • Jim: Hey, I checked two products like dimdim and cutepdf but none is free. What are you talking about free and open source?
  • George Michie: If they keep hearing the same message, and seeing evidence in the data to back it up, something will have to give. There is hope on...
  • Tomas: I’ve been having the same argument with Google for months now and in the end there does seem to be a feature in the algorithm that...
  • George Michie: Doesn’t have to be, it can be intra-adgroup as well.
  • Josh: George – I take it you’re referencing a scenario where your exact-match keywords are not listed as negative exact match keywords...
  • George Michie: Melissa, you’re right, it’s always happened to varying degrees, particularly since the advent of extended broad match....

Blog Stats

  • Posts: 948
  • Words: 451,089
  • Comments: 2,877

Administration