Problemes amb accents i sí­mbols estranys a wordpress?

Si després d’una migració o actualització del vostre wordpress us trobeu que determinats caràcters apareixen com sí­mbols incorrectes (탳, 탭, íƒ², 탨…), segurament es deurà amb alguna malfunció entre el mapa de caràcters UTF-8 i ISO.

Buscant una mica per internet, he trobat diferents opcions per resoldre-ho. La més fàcil i coherent m’ha semblat que és la que trobareu a: https://gist.github.com/ericrasch/7220890

On simplement cal executar un script de base de dades per tal de canviar tots els caràcters incorrectes per els correctes segons el nostre mapa de caràcters.

El copio a continuació per facilitar la tasca si en alguna ocasió us trobeu en la mateixa situació.

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` ,’í¢â‚¬”‘,’–’);
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` ,’í¢â‚¬¡’,’c’);
update `wp_posts` set `post_content` = replace(`post_content` ,’í‚’,”);

update `wp_posts` set `post_title` = replace(`post_title` ,’탡’,’á’);
update `wp_posts` set `post_title` = replace(`post_title` ,’탩’,’é’);
update `wp_posts` set `post_title` = replace(`post_title` ,’í­©’,’é’);
update `wp_posts` set `post_title` = replace(`post_title` ,’탳’,’ó’);
update `wp_posts` set `post_title` = replace(`post_title` ,’í­º’,’ú’);
update `wp_posts` set `post_title` = replace(`post_title` ,’탺’,’ú’);
update `wp_posts` set `post_title` = replace(`post_title` ,’탱’,’ñ’);
update `wp_posts` set `post_title` = replace(`post_title` ,’í­”˜’,’Ñ’);
update `wp_posts` set `post_title` = replace(`post_title` ,’탒,’í­’);
update `wp_posts` set `post_title` = replace(`post_title` ,’í¢â‚¬”‘,’–’);
update `wp_posts` set `post_title` = replace(`post_title` ,’í¢â‚¬”’,’–’);
update `wp_posts` set `post_title` = replace(`post_title` ,’í¢â‚¬â„¢’,’\”);
update `wp_posts` set `post_title` = replace(`post_title` ,’í¢â‚¬¦’,’…’);
update `wp_posts` set `post_title` = replace(`post_title` ,’í¢â‚¬”‘,’-‘);
update `wp_posts` set `post_title` = replace(`post_title` ,’í¢â‚¬Å“’,'”‘);
update `wp_posts` set `post_title` = replace(`post_title` ,’í¢â‚¬’,'”‘);
update `wp_posts` set `post_title` = replace(`post_title` ,’í¢â‚¬Ëœ’,’\”);
update `wp_posts` set `post_title` = replace(`post_title` ,’í¢â‚¬¢’,’-‘);
update `wp_posts` set `post_title` = replace(`post_title` ,’í¢â‚¬¡’,’c’);
update `wp_posts` set `post_title` = replace(`post_title` ,’í‚’,”);

update `wp_postmeta` set `meta_value` = replace(`meta_value` ,’탡’,’á’);
update `wp_postmeta` set `meta_value` = replace(`meta_value` ,’탩’,’é’);
update `wp_postmeta` set `meta_value` = replace(`meta_value` ,’í­©’,’é’);
update `wp_postmeta` set `meta_value` = replace(`meta_value` ,’탳’,’ó’);
update `wp_postmeta` set `meta_value` = replace(`meta_value` ,’í­º’,’ú’);
update `wp_postmeta` set `meta_value` = replace(`meta_value` ,’탺’,’ú’);
update `wp_postmeta` set `meta_value` = replace(`meta_value` ,’탱’,’ñ’);
update `wp_postmeta` set `meta_value` = replace(`meta_value` ,’í­”˜’,’Ñ’);
update `wp_postmeta` set `meta_value` = replace(`meta_value` ,’탒,’í­’);
update `wp_postmeta` set `meta_value` = replace(`meta_value` ,’í¢â‚¬”‘,’–’);
update `wp_postmeta` set `meta_value` = replace(`meta_value` ,’í¢â‚¬”’,’–’);
update `wp_postmeta` set `meta_value` = replace(`meta_value` ,’í¢â‚¬â„¢’,’\”);
update `wp_postmeta` set `meta_value` = replace(`meta_value` ,’í¢â‚¬¦’,’…’);
update `wp_postmeta` set `meta_value` = replace(`meta_value` ,’í¢â‚¬”‘,’-‘);
update `wp_postmeta` set `meta_value` = replace(`meta_value` ,’í¢â‚¬Å“’,'”‘);
update `wp_postmeta` set `meta_value` = replace(`meta_value` ,’í¢â‚¬’,'”‘);
update `wp_postmeta` set `meta_value` = replace(`meta_value` ,’í¢â‚¬Ëœ’,’\”);
update `wp_postmeta` set `meta_value` = replace(`meta_value` ,’í¢â‚¬¢’,’-‘);
update `wp_postmeta` set `meta_value` = replace(`meta_value` ,’í¢â‚¬¡’,’c’);
update `wp_postmeta` set `meta_value` = replace(`meta_value` ,’í‚’,”);

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.