#28027 closed Bug (invalid)
UTF-8 in help_text in models.ManyToManyField doesn't work anymore
Reported by: | Thomas Kähn | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 1.11 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hi,
since Django 1.11 UTF-8 text in help_text in models.ManyToManyField results in UnicodeDecodeError:
'ascii' codec can't decode byte 0xc3 in position 33: ordinal not in range(128)
Error during template rendering
In template [...]/python2.7/site-packages/django/contrib/admin/templates/admin/includes/fieldset.html, error at line 7
In Django 1.10 UTF-8 in help_texts worked fine. In other fields in Django 1.11 it is possible to use UTF-8 in help_texts.
I am using Python 2.7.
Best regards
Thomas
Change History (3)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Confirmed that a UTF=8 encoded bytestring is needed to reproduce the crash.
For the record, the commit that introduced the change is 2315114090815aed72be2b9bc936d7b6374f12fc.
comment:3 by , 8 years ago
Hi,
thank you very much for the hints and link to the commit. I can also confirm that the problem is gone when using Unicode strings.
Best regards
Thomas
Is your UTF-8 content inside a Unicode string, or is it a bytestring?
If you put UTF-8 encoded content as a bytestring, I would call that a programming error on your side. If it worked before, it was purely by accident.