MySQL: CharField's with utf8_bin collation return as str, should return as unicode.
|Reported by:||Graham King||Owned by:||Graham King|
|Component:||Database layer (models, ORM)||Version:||master|
|Severity:||Normal||Keywords:||mysql utf_bin unicode|
|Cc:||Triage Stage:||Design decision needed|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
On MySQL, a CharField with default collation comes out as unicode, but with utf8_bin it comes out as str.
Adding this line into the conversion dictionary (in django/db/backends/mysql/base.py) fixes it:
FIELD_TYPE.VAR_STRING: [(None, force_unicode)],
Patch includes two tests in regressiontests/backends/. The full test suite passes with this patch applied.
Change History (6)
comment:1 Changed 5 years ago by
|Owner:||changed from nobody to Graham King|
|Patch needs improvement:||unset|