查看我的prod日志后,我提到了一些错误:
[2012-08-31 15:56:43] request.CRITICAL: Doctrine\DBAL\DBALException:
An exception occurred while executing 'SELECT t0.username ....... FROM fos_user t0 WHERE t0.username = ?'
with params {"1":"Nrv\u29e7Kasi"}:
SQLSTATE[HY000]: General error: 1267 Illegal mix of collations (latin1_swedish_ci,IMPLICIT)
and (utf8_general_ci,COERCIBLE) for operation '='
Alghout我在学说cfg:
下有UTF-8默认值doctrine:
dbal:
charset: UTF8
似乎我的所有MySQL表都在latin1_swedish_ci
中,所以我的问题是:
我是否可以手动将排序规则更改为utf8_general_ci
,无需任何复杂/预防措施?
答案 0 :(得分:8)
多数民众赞成。我遇到了这个问题,最好的快速和快速的解决方案是
CONVERT(fos_user.username USING utf8)
答案 1 :(得分:3)
只需按命令转换表的字符集,如下所示,
ALTER TABLE tbl_name CONVERT TO CHARACTER SET utf8;