Monday, August 18, 2008

Different encoding error

if you found yourself suffering with this error

ActiveRecord::StatementInvalid: Mysql::Error: #HY000Incorrect string value

don't cry or check your code looking at the data you save thinking that you might have left some bad characters around causing you this misery

all you need to do is to check the used database connection encoding against your db tables encoding, most probably you will find them different

if so then the solution is one of these two options
1) remove encoding field from specification and use default db encoding
2) change the encoding of your db tables to this encoding

once you do so, you will have a good life

No comments: