Subscribe

Remove “question mark inside a black diamond” in mySQL

I started looking for results on Google for my problem (removing the question mark inside a black diamond), but no one seemed to have the correct answer.

See, I am working with a large SQL database and simply editing each record to correct this problem wouldn’t work. After looking on Google I found that the problem was with a non-breaking space not displaying properly even though my HTML (and database) character set is UTF-8. I finally found a solution after many hours of searching and I wanted to share it with everyone:

UPDATE table_name SET field = Replace(field, Char(160), ‘ ‘)

Hopefully this will save you from hours of searching online :-)

Author: Adam Parker

Enjoy this Post? Share it on your favorite social bookmarking site...

 

Submit to Mixx Submit to StumbleUpon Submit to Delicious Submit to Digg

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

3 Comments

Jon

December 25th, 2009

Adam, thanks for this post. I recently upgraded my MySQL 4 database to a MySQL 5 database in order to upgrade to the latest version of WordPress (2.9) and encountered this exact problem. I have been looking for a solution for quite some time now, and I think your post might be it.

Can you explain in a little more detail exactly what your query does? Also, since I am a complete newbie when it comes to understanding MySQL databases, could you perhaps do a step-by-step, or offer a little more handholding, on how to run the above query? I know I don't have SSH access to my account, but I have phpMyAdmin both from within my hosting package and within WordPress. Any help would be greatly appreciated!

adamkparker

December 26th, 2009

Basically that query is going to replace each of the double spaced characters (which is character code 160) with a single space. You just need to plug in the table name that has the problems and the field you want to fix.

This query can be run in phpMyAdmin, just select your database and run the query.

Jon

January 2nd, 2010

Hi Adam,

Thanks for the reply. I attempted to run this query and received the following error:

#1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '‘)' at line 1

Any thoughts on what might be causing this?

Leave a Reply

Related Posts

Check out some more great tutorials and articles that you might like.