Greg Ewing schrieb: >> All sorts of things are different when reading stdin vs. opening a >> filename. e.g. stdin may be a pipe. > > Which suggests that if anything is going to try > to guess the encoding, it would be better for it > to start reading from the actual stream you're > going to use and buffer the result, rather than > rely on being able to open it separately.
As Guido says: *all* sorts of things are different. When stdin is a terminal, there are separate API functions which we should use to determine the terminal's encoding. This does neither require to read data from a stream, nor to open a file. If we read data from a pipe, it is probably most natural to assume that the system code page/locale encoding is used for these data. Regards, Martin _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com