Updated FAQ adding solution to the mysql non utf-8 collation issue

This commit is contained in:
Roberto Rosario
2011-11-15 07:03:40 -04:00
parent 946e4fcf50
commit 592cd373a7

View File

@@ -5,6 +5,28 @@ FAQ
Frequently asked questions and solutions
_mysql_exceptions.OperationalError: (1267, "Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='")
------------------------------------------------------------------------------------------------------------------------------------------------------
* Solution::
$ manage.py shell
>>> from django.db import connection
>>> cursor = connection.cursor()
>>> cursor.execute('SHOW TABLES')
>>> results=[]
>>> for row in cursor.fetchall(): results.append(row)
>>> for row in results: cursor.execute('ALTER TABLE %s CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;' % (row[0]))
* References:
- http://www.djangoshmango.com/?p=99
- http://stackoverflow.com/questions/1073295/django-character-set-with-mysql-weirdness
Incorrect string value: ``'\xE2\x80\x95rs6...'`` for column ``'content'`` at row 1
----------------------------------------------------------------------------------