How to fix strange characters in MySQL database – Vinh Pham

dp, 26 January 2010, View Comments
Categories: Servers
Tags: , , , ,

I admit, I borrowed this from How to fix strange characters in MySQL database – Vinh Pham. But I also added a few more that were missing;


update <table> set <field> = replace(<field>, '’', '\'');
update <table> set <field> = replace(<field>, '…', '&hellip;');
update <table> set <field> = replace(<field>, '–', '-');
update <table> set <field> = replace(<field>, '“', '"');
update <table> set <field> = replace(<field>, '”', '"');
update <table> set <field> = replace(<field>, '‘', '\'');
update <table> set <field> = replace(<field>, '•', '-');
update <table> set <field> = replace(<field>, '‡', 'c');
update <table> set <field> = replace(<field>, 'â„¢', '&trade;');
update <table> set <field> = replace(<field>, '®', '&reg;');

Hopefully this helps someone (probably even me) sometime down the road!

Related posts:

  1. Databases and backups Yesterday, I managed to delete the primary database that we...

Comments

  • http://www.facebook.com/mdanielpatrick Daniel Patrick

    Wow, dude. I needed this. Nice. Thank you.

  • http://www.facebook.com/mdanielpatrick Daniel Patrick

    What causes this problem in the first place? I updated my wordpress one day and noticed they popped into my posts.

  • http://www.facebook.com/mdanielpatrick Daniel Patrick

    Wow, dude. I needed this. Nice. Thank you.

  • http://www.facebook.com/mdanielpatrick Daniel Patrick

    What causes this problem in the first place? I updated my wordpress one day and noticed they popped into my posts.

blog comments powered by Disqus