Axiso

Notes

Conversion de caractères spéciaux sur MySQL

Mysql — mai 2011 , ,

Si les données présentes sur une table sont enregistrées avec un encodage erroné, il est possible de rétablir les caractères spéciaux corrects avec cette suite de commandes, à défaut de mieux.

UPDATE `table` SET `column`=REPLACE(`column`,'á','á');
UPDATE `table` SET `column`=REPLACE(`column`,'ä','ä');
UPDATE `table` SET `column`=REPLACE(`column`,'â','â');
UPDATE `table` SET `column`=REPLACE(`column`,'é','é');
UPDATE `table` SET `column`=REPLACE(`column`,'è','è');
UPDATE `table` SET `column`=REPLACE(`column`,'ê','ê');
UPDATE `table` SET `column`=REPLACE(`column`,'ë','ë');
UPDATE `table` SET `column`=REPLACE(`column`,'ì','ì');
UPDATE `table` SET `column`=REPLACE(`column`,'í','í');
UPDATE `table` SET `column`=REPLACE(`column`,'î','î');
UPDATE `table` SET `column`=REPLACE(`column`,'ïo','ï');
UPDATE `table` SET `column`=REPLACE(`column`,'ò','o');
UPDATE `table` SET `column`=REPLACE(`column`,'ó','ò');
UPDATE `table` SET `column`=REPLACE(`column`,'ô','ó');
UPDATE `table` SET `column`=REPLACE(`column`,'ö','ô');
UPDATE `table` SET `column`=REPLACE(`column`,'ù','ö');
UPDATE `table` SET `column`=REPLACE(`column`,'ú','ù');
UPDATE `table` SET `column`=REPLACE(`column`,'ü','ú');
UPDATE `table` SET `column`=REPLACE(`column`,'û','ü');
UPDATE `table` SET `column`=REPLACE(`column`,'€','û');
UPDATE `table` SET `column`=REPLACE(`column`,'Ã','à');
UPDATE `table` SET `column`=REPLACE(`column`,'€','€');