Easily remove weird characters from your WordPress database // Eliminación sencilla de caracteres incorrentos en tu base de datos WordPress

(Español abajo)

If your WordPress database is filled with weird characters (for example, if you pasted something from Microsoft Word…) the following recipe will solve the problem by replacing those characters by the correct characters.

Simply run the following SQL query on your WordPress database, using the command line client or PhpMyAdmin. This will remove weird characters from all your posts and comments. Don’t forget to backup your database before using this query.

Si tu base de datos WordPress está con caracteres incorrectos (por ejemplo, si has pegado algo de Microsoft Word…) el siguiente código resolverá el problema de reemplazar aquellos caracteres incorrectos por los correctos caracteres.

Simplemente ejecutando la siguiente sentencia SQL en tu base de datos WordPress, usando la linea de comandos del cliente o en PhpMyAdmin. Esto eliminará caracteres erroneos de todos tus post y comentarios. No olvides hacer una copia de seguridad de tu base de datos antes de utilizar esta sentencia.

Query:

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, '…', '…');
Link: http://digwp.com/2011/07/clean-up-weird-characters-in-database/