Archive for December 9th, 2013

9th December
2013
written by simplelight

I was getting the following error in Airbrake for my Rails app which uses MySQL:

Mysql2::Error: Incorrect string value: '\xCE\x94\xCE\xB1\xCE\xBD...' for column 'comment'

This was caused by the fact that many of my older tables still used legacy encoding.

To convert tables to UTF8 issue the following command at the MySQL prompt:

ALTER TABLE tweets CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;

To find tables that have legacy encoding use:

SHOW TABLE STATUS;

Tags: