kennethreitz/requests — pull request #390 by davidarkemp (2012-01-26 19:44:48+00:00)
Title: add failing test for unicode headers (python 2.x only)

This adds a failing test for unicode headers in python 2.x (I've tested python 2.6)
I've tried to fix this the original problem is that in [utils.py (line 149)](https://github.com/kennethreitz/requests/blob/develop/requests/utils.py#L149) doesn't check for unicode, or rather that it doesn't import the str and bytes definitions from compat). However, you *might* want to change the order of the [definitions of str and bytes for python 2 in compat](https://github.com/kennethreitz/requests/blob/develop/requests/compat.py#L89), because, at the moment, they end up both being defined as unicode.
Right, so, if one fixes this (I've got the code if you want that too), and then there ends up being a problem with gevent's socket just calling data.decode(), which fails on my linux box, because that ends up trying to convert everything to ascii (which seems to be default behaviour).
I can work around this by making sure I only ever pass py2's strs as keys and values, but I'd like to make it work if you can point me in the right direction.