#13583 closed (invalid)
Invalid localization of error_messages in form fields
Reported by: | dmitry_nosov | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | 1.2 |
Severity: | Keywords: | error_messages | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
If I use this construction:
forms.IntegerField(min_value=1, max_value=5, error_messages = { 'max_value': u'Ошибка!', })
The error message output is
u'u041e\u0448\u0438\u0431\u043a\u0430!'
Instead of
u'Ошибка!'
Change History (3)
comment:1 by , 15 years ago
comment:2 by , 14 years ago
Description: | modified (diff) |
---|---|
Resolution: | → invalid |
Status: | new → closed |
There is not enough information here to figure out what's going on....the error message output where? In a template, the snippet provided does produce correct output by default (for example if {{ form }}
is used in the template for display). I suspect the observed problem is due to some incorrect way of outputting the error information in the template, or, if the "output" being referred to is some debugging information, then a misunderstanding about how Python displays unicode string representations (as phxx notes), not a bug in Django. A better place to ask for help in either case would be django-users.
I cannot confirm this.
The following code generates the expected output:
outputs
Your confusion might be resulting of python's behaviour how unicode strings are handled. If you use a character like б in a string it will be converted into its unicode number which is \u0431 in this case.