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”


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.

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

  • Nancy Kast: I am writing about your billing and online services. I have been receiving calls saying my bill is not paid. My husband pays all our...
  • Marc Adelman: George, Thanks for sharing this data. From an online buzz perspective, Bing is making a big splash. Everyone is talking about it....
  • George Michie: Hi Dennis, I’m not a lawyer, so take anything I say on this with a grain of salt (and please don’t sue us if we’re...
  • survey online: unfortunatelly i have to say that Google tools are the easiest survey web
  • Dennis Yu: Alan, We’ve had several C&D’s sent to us for seemingly innocuous issues. One of our casual dining clients bid on a...
  • George Michie: Hi Vivek, Haven’t had time to put together a full update, but I did take a look at the numbers. No material gains in market...
  • Karridy: You should checkout ClickPath’s call to KW tracking.
  • Vivek: George, really enjoying reading about the analysis you guys do. Was wondering if you have an update on this given a couple more weeks have...
  • Vicki Swaim: Dear Mr.Ullman, I hope you can help me with my problem. I ordered a TV stand the end of April that was advertised as a close out item....
  • Luke: It’s a shame we live in such a litigious society. Why should we have to set up an association? Surely we can prevent senseless...
  • George Michie: Josh, we have had shots fired over our bow and our client’s in the past. Usually responsible companies are reasonable about...
  • Ryan: Ok, George, I’m sufficiently scared… Thanks… :-) Incidentally, are there any trademark resources (other than Google...
  • Josh: We have run into trademark issues for several clients, although it has so far been a matter of trying to make “fair use” of a...
  • Mike: THANK YOU! I love you man!! :)
  • Matthew: Francis, We’ve likewise seen the “A-List” phenomenon in the past. Perhaps with Bing.com, there won’t be anymore of...

Blog Stats

  • Posts: 871
  • Words: 392,916
  • Comments: 2,079

Administration