#3395 closed (duplicate)
UnicodeError with newforms and non-english error messages
| Reported by: | 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)
Change History (7)
by , 19 years ago
| Attachment: | unicode_newforms_errors.patch added | 
|---|
comment:1 by , 19 years ago
| Triage Stage: | Unreviewed → Design decision needed | 
|---|
comment:2 by , 19 years ago
| Resolution: | → duplicate | 
|---|---|
| Status: | new → closed | 
duplicate of #3344
sorry, didn't find it before...
by , 19 years ago
| Attachment: | decode-before-unicode.patch added | 
|---|
This helped me, should this be checked in or is there something i'm missing here?
comment:3 by , 19 years ago
Added patch for "funky" characters, decodes the utf8, then re-encodes as unicode.
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?