How to import UTF-8 encoded files into MySQL without outputting garbage
Jul 1, 2009
A recent Drupal localization project proved relatively painless until we moved the data from a local machine to a staging server. Importing thousands of lines of Bulgarian into a MySQL database went smoothly BUT when Drupal pulled the data it looked like gibberish.
The database’s collation was properly set to UTF-8 but it refused to output Cyrillic instead of garbage. The solution? Edit your MySQL options file to change the server’s character set to UTF-8. Adding character-set-server = utf8 to my.cnf should do the trick.