The easiest way of converting a MySQL DB from latin1 to UTF8
Posted by Kelvin on 16 Nov 2012 at 06:24 pm | Tagged as: programming
There are *numerous* pages online describing how to fix those awful junk characters in a latin1 column caused by unicode characters.
After spending over 2 hours trying out different methods, I found one that's dead simple and actually works:
Export:
mysqldump -u $user -p --opt --quote-names --skip-set-charset \ --default-character-set=latin1 $dbname > dump.sql
Import:
mysql -u $user -p --default-character-set=utf8 $dbname < dump.sql
Thank you Gareth!
http://www.garethsprice.com/blog/2011/fix-mysql-latin1-utf-character-encoding/