Updated FAQ adding solution to the mysql non utf-8 collation issue
This commit is contained in:
22
docs/faq.rst
22
docs/faq.rst
@@ -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
|
||||
----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user