Everything you did not want to know about Unicode in Python 3

Ian Kelly ian.g.kelly at gmail.com
Wed May 14 11:56:54 EDT 2014


On Wed, May 14, 2014 at 9:30 AM, Robin Becker <robin at reportlab.com> wrote:
> Doesn't this issue also come up wherever bytes are being read ie in sockets,
> pipe file handles etc? Some sources may have well defined encodings and so
> allow use of unicode strings but surely not all. I imagine all of the
> problems associated with a broken encoding promise for stdin can also occur
> with sockets & other sources ie error messages failing to be printable etc
> etc. Since bytes in Python 3 are not equivalent to the old str (Python 3
> bytes != Python 2 str) using bytes everywhere has its own problems.

Sockets send and receive bytes, and pipes created by the subprocess
module are opened in binary mode.  Pipes inherited as stdin are still
assumed to be unicode, though.



More information about the Python-list mailing list