How to Clean Up Weird Characters in Database?

I'm looking for a PHp library which converts such text and does this in a standardized way because there are a lot more characters than just the ones i've listed here - eg the (c) copyright symbol, etc...


I am getting such kind of output: "Sch�ls" => "Schools"

Let me know if anyone have solutions..



Asked 20 Aug, 18 at 05:20 AM

Tim Martin
Php Javascript Wordpress

Answer

Hi, 


You should use the following queries:

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_comments SET comment_content = REPLACE(comment_content, '“', '"');
UPDATE wp_comments SET comment_content = REPLACE(comment_content, 'â€', '"');
UPDATE wp_comments SET comment_content = REPLACE(comment_content, '’',  "'");
UPDATE wp_comments SET comment_content = REPLACE(comment_content, '‘',  "'");
UPDATE wp_comments SET comment_content = REPLACE(comment_content, '—', '-');
UPDATE wp_comments SET comment_content = REPLACE(comment_content, '–', '-');
UPDATE wp_comments SET comment_content = REPLACE(comment_content, '•', '-');
UPDATE wp_comments SET comment_content = REPLACE(comment_content, '…', '...');

Use it and tell me if it works to you or not.

like

The above solution will work in case of Wordpress

like