Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#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 Claude Paroz, 7 years ago

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.

comment:2 by Tim Graham, 7 years ago

Resolution: invalid
Status: newclosed

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 Thomas Kähn, 7 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

Note: See TracTickets for help on using tickets.
Back to Top