Opened 17 years ago
Closed 17 years ago
#4698 closed (wontfix)
ChoiceField unicode problem
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Keywords: | unicode | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
when I use a string or unicode object with non-ascii characters, I got the following error
UnicodeEncodeError at /user/new/
'ascii' codec can't encode character u'\u0131' in position 2: ordinal not in range(128)
Exception Location: /usr/lib/python2.4/site-packages/django/newforms/fields.py in clean, line 430
when i change
valid_values = set([str(k) for k, v in self.choices])
to
valid_values = set([k for k, v in self.choices])
it works for me. I'm sure this breaks things so I think the first action is a bug. ChoiceList should validate non-ascii chars.
Non-ASCII characters are not supported on trunk at the moment. There are many problems like this throughout the code. Either use the UnicodeBranch or wait a very short while until that branch is merged into trunk.