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 3 years ago by graham_king
- Needs documentation unset
- Needs tests unset
- Owner changed from nobody to graham_king
- Patch needs improvement unset
comment:2 Changed 3 years ago by kmtracey
- Triage Stage changed from Unreviewed to Design decision needed