Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Handling of non-ascii usernames #8
Non-ascii usernames seems a bit broken at the moment, at least on python2. Since
The WSGI pep says native strings must be used but they're not the same thing in py2 and py3.
I've tried to come up with an implementation that doesn't break on unicode based on what webtest does data but failed so far.
added a commit
Jun 9, 2013
That's a weird ticket. Username is passed through WSGI environment variable (which is a header if I'm not mistaken). Headers must be latin1-encoded bytes in Python 2.x and latin1-encodable unicode string in Python 3.x.
Quote from PEP-3333:
Latin-1 can't handle full unicode range, so I think it is bad to use it as encoding for unicode usernames.
I think in Python 2.x we can pass utf8-encoded bytestring and decode it (because there is no automatic encoding-decoding). In Python 3.x we may create a 'fake' unicode string that will be encoded to latin1 (
After all, I gave up understanding specs :)
The idea implemented in a commit above is just to quote/unquote WEBTEST_USER variable to make it ASCII without encodings juggling. What do you think?