The last few weeks we noticed the dreaded question marks on our sites running against MySQL 5.0. We thought we did everything to make sure our servers, databases, tables, clients and connections understood UTF-8, but somehow connections to the database were reset back to Latin1 after some time.
Instead of trying to fix the problem in Rails/Ruby/libmysql I decided to squash the problem in the MySQL server configuration. By default we were seeing this:
So I set the following in /etc/mysql/my.cnf:
Which forces all the encoding to go to UTF-8 by default:
You’re reading an archived weblog post that was originally published on our website.