Skip to content

Instantly share code, notes, and snippets.

@dbrant
Created October 27, 2021 01:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbrant/75d3d362320f9375df147dd7df53ae54 to your computer and use it in GitHub Desktop.
Save dbrant/75d3d362320f9375df147dd7df53ae54 to your computer and use it in GitHub Desktop.
Fix incorrectly encoded quotes and apostrophes in SQL database
UPDATE wp_posts SET post_content = REPLACE(post_content, '“', '“');
UPDATE wp_posts SET post_content = REPLACE(post_content, '”', '”');
UPDATE wp_posts SET post_content = REPLACE(post_content, '’', '’');
UPDATE wp_posts SET post_content = REPLACE(post_content, '‘', '‘');
UPDATE wp_posts SET post_content = REPLACE(post_content, '—', '–');
UPDATE wp_posts SET post_content = REPLACE(post_content, '–', '—');
UPDATE wp_posts SET post_content = REPLACE(post_content, '•', '-');
UPDATE wp_posts SET post_content = REPLACE(post_content, '…', '…');
UPDATE wp_posts SET post_content = REPLACE(post_content, '…', '…');
UPDATE wp_posts SET post_content = REPLACE(post_content, 'Â', ' ');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment