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.
The text was updated successfully, but these errors were encountered:
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?