On Wed, May 14, 2014 at 9:30 AM, Robin Becker <ro...@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.