Django排序规则(latin1_swedish_ci,IMPLICIT)和(utf8_general_ci,COERCIBLE)的非法混合

sup*_*rio 6 django utf-8

我正在将Django 1.5.4和Django-Regsitration模块一起使用。每当我尝试使用波斯字体注册用户时,都会出现此错误:

DatabaseError at /accounts/register/
(1267, "Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'like'")
Request Method: POST
Request URL:    http://127.0.0.1:8000/accounts/register/
Django Version: 1.5.4
Exception Type: DatabaseError
Run Code Online (Sandbox Code Playgroud)

我创建的其他表单也存在类似的问题:每当我用波斯字体填充字段时,都会出现类似以下错误:

Warning at /accounts/profile/
Incorrect string value: '\xDA\xA9\xD8\xA7\xD8\xB1...' for column 'occupation' at row 1
Run Code Online (Sandbox Code Playgroud)

为了解决这个问题,我做到了:

使用PhpMyAdmin,我已将数据库的排序规则更改为'utf8_general_ci

没有效果。

我还对数据库执行了utf8:

mysql> ALTER DATABASE djangodb  charset=utf8;
Run Code Online (Sandbox Code Playgroud)

仍然没有效果。

因此,感谢您的提示。