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...

Comments

  • What causes this problem in the first place? I updated my wordpress one day and noticed they popped into my posts.
  • Wow, dude. I needed this. Nice. Thank you.
blog comments powered by Disqus