16 December 2010

"Incorrect string value"

If you see an "Incorrect string value" error in Django and you're using MySQL, run

SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'your-table-name'

and check the CHARACTER_SET_NAME for the column in question.

If it's not set correctly (e.g., it's latin1 and you're trying to insert utf8), change it with

alter table table modify column type character set utf8;

No comments:

Post a Comment

About Me

blog at barillari dot org Older posts at http://barillari.org/blog