[Python-Dev] teaching the new urllib (original) (raw)

Daniel (ajax) Diniz ajaksu at gmail.com
Wed Feb 4 00:56:48 CET 2009


Tres Seaver wrote:

Brett Cannon wrote:

No because you are getting back the repr for the bytes object. Str does not know what the encoding is for the bytes so it has no way of performing the decoding. The encoding information is available in the response headers, e.g.: [snip]

That's the target of http://bugs.python.org/issue4733 cited by Benjamin: 'Add a "decode to declared encoding" version of urlopen to urllib' . I think it's an important use case, but the current patch is pretty awful. Improvements/feedback welcome :)

Daniel



More information about the Python-Dev mailing list