Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#3395 closed (duplicate)

UnicodeError with newforms and non-english error messages

Reported by: Honza Král <Honza.Kral@…> Owned by: Adrian Holovaty
Component: Forms Version: dev
Severity: Keywords: unicode newforms errors
Cc: Honza.Kral@… Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When I use LANGUAGE_CODE = 'cs' and have some errors in newforms, the template rendering fails because the errors are unicode strings, and the rest of the system fails to handle that correctly (so trying {{ form.field.errors|join:", " }} fails horribly).

I attached a patch that takes care of the problem by encoding all the errors using settings.DEFAULT_CHARSET in ValidationError .

All tests pass

Attachments (4)

unicode_newforms_errors.patch (28.2 KB ) - added by Honza Král <Honza.Kral@…> 18 years ago.
unicode_newforms_errors_new.patch (28.6 KB ) - added by Honza Král <Honza.Kral@…> 18 years ago.
this one actually works ;)
decode-before-unicode.patch (540 bytes ) - added by Øyvind Saltvik <oyvind.saltvik@…> 18 years ago.
This helped me, should this be checked in or is there something i'm missing here?
decode-before-unicode.2.patch (539 bytes ) - added by Øyvind Saltvik <oyvind.saltvik@…> 18 years ago.
Oops, this helped me

Download all attachments as: .zip

Change History (7)

by Honza Král <Honza.Kral@…>, 18 years ago

comment:1 by Honza Král <Honza.Kral@…>, 18 years ago

Triage Stage: UnreviewedDesign decision needed

Changing triage stage to design decision needed - Do we want this, or is there some cleaner and simpler way how to make newforms' errors work for "funky" characters?

by Honza Král <Honza.Kral@…>, 18 years ago

this one actually works ;)

comment:2 by Honza Král <Honza.Kral@…>, 18 years ago

Resolution: duplicate
Status: newclosed

duplicate of #3344

sorry, didn't find it before...

by Øyvind Saltvik <oyvind.saltvik@…>, 18 years ago

Attachment: decode-before-unicode.patch added

This helped me, should this be checked in or is there something i'm missing here?

by Øyvind Saltvik <oyvind.saltvik@…>, 18 years ago

Oops, this helped me

comment:3 by Øyvind Saltvik <oyvind.saltvik@…>, 18 years ago

Added patch for "funky" characters, decodes the utf8, then re-encodes as unicode.

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