[Twisted-Python] Twisted for Python 3

Itamar Turner-Trauring itamar at itamarst.org
Wed Oct 19 12:38:58 EDT 2011

> Agreed. But we are talking about data decoded by a protocol here.

Banana is very low-level in the PB stack, and is explicitly designed to
send bytes, not unicode. It's Jelly that does unicode, and even there you
shouldn't need to change anything.

If the protocol decodes to bytes in Python 2, you should keep it as bytes.
E.g. twisted.web.client.getPage result should fire with bytes, not unicode
(downloading a JPEG and then decoding it to unicode isn't that useful).
For many old protocol it's not even possible to know what encoding will
work, and potentially it might use multiple different encodings in
different situations, and if you just pick UTF-8 you'll make the library
unusable for some people.

More information about the Twisted-Python mailing list