Opened 8 years ago

Closed 8 years ago

#4698 closed (wontfix)

ChoiceField unicode problem

Reported by: canburak@… Owned by: adrian
Component: Forms Version: master
Severity: Keywords: unicode
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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.

Change History (1)

comment:1 Changed 8 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

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.

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