rails3.1でMySQLからやってくる文字列がASCII-8BITになっているのでto_jsonすると壊れる(to_jsonがencodingを見て処理するので)。sqlite3では起こらない。 環境はSnow Leopard、ruby1.9.2-p290、homebrewで入れたmysql 5.1.54。 % rails new foo % cd foo % vi Gemfile (...) gem 'mysql' (...) % bundle % vi config/database.yml (...) development: adapter: mysql encoding: utf8 database: foo_development pool: 5 username: root password: host: localhost socket: /tmp/mysql.sock