Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean() in forms fails if a value that is not ascii is selected #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

phillipberndt
Copy link
Contributor

In my example, I had "Dänemark" (german for Denmark) as a choice. The problem is the line

setattr(result, str(k), True)

in forms.py. If k is non-ascii unicode, then str will fail. My proposed solution is to always try to interpret k as unicode and then encode to utf-8, if Python 2 is used. This seems to work as intended (No AttributeError is raised) and while this admittetly also does not cover all use cases, it will work for most users.

setattr(object, unicode that can't be encoded to ascii, value) did not
work there. So instead, force encoding as utf8 which hopefully everyone
out there uses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant