Closed RendijsSmukulis closed 7 years ago
What happens if we always encode in 'UTF-8'? Would that work in python2?
That'll work too. In Python2 it'll still be a string, but each character will be encoded in an 8 bit representation (so 1 or more bytes), so it's essentially same as a byte array (which is one and the same in py2, not so much in py3). Thanks for looking at this, I'll update the pull request in a moment!
Cool, thanks! I don't like checking for versions if we can avoid it :)
Hi!
Do you think this can be merged in the current state, or is there any other work required?
Yes, thank you!
urllib2 in python2 expects data as a string, while urllib in python3 expects a byte array. This change ensures we encode the string if running in python 3.
This fixes https://github.com/omergertel/pyformance/issues/39