Opened 7 years ago

Closed 6 years ago

Last modified 4 years ago

#9118 closed (wontfix)

Unhelpful handling of UTF_8 encoding bugs in ModelForm field.help_text

Reported by: jbl1 Owned by:
Component: Forms Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I am modifying a field of a model in ModelForm and adding a help_text with national characters. The declared encoding is UTF_8, but the actual help_text contains a wrong diacritic (not UTF_8 encoded). The complete form.as_table within my template called does quietly not render -- it just doesn't show. The template displays correctly when the diacritic in error gets removed or corrected.

If I remove the UTF_* coding declaration in the original error situation then the following is reported:

Non-ASCII character '\x9c' in file <forms.py pointer removed> on line 43, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details (forms.py, line 43)


Change History (7)

comment:1 Changed 7 years ago by jbl1

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Summary changed from Unhelpfull handling of UTF_8 encoding bugs in ModelForm field.help_text to Unhelpful handling of UTF_8 encoding bugs in ModelForm field.help_text

comment:2 Changed 6 years ago by jacob

  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 6 years ago by jacob

  • milestone set to 1.1

comment:4 Changed 6 years ago by kgrandis

  • Owner changed from nobody to kgrandis
  • Status changed from new to assigned

comment:5 Changed 6 years ago by kgrandis

  • Owner kgrandis deleted
  • Status changed from assigned to new

comment:6 Changed 6 years ago by jacob

  • Resolution set to wontfix
  • Status changed from new to closed

I'm not quite sure what Django can do better here; if you've got an invalid encoding in your source file, that's on you.

The reason you're not getting an error in the template is because it's generally the policy that invalid data shouldn't cause the template rendering to break. That's mostly a good policy, and we can't change it even though in this particular case it's causing more harm than good.

comment:7 Changed 4 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

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