Matt Mackall <m...@selenic.com> added the comment: The underlying cause of Python's write exceptions with cp65001 is:
The ANSI C write() function as implemented by the Windows console returns the number of _characters_ written rather than the number of _bytes_, which Python reasonably interprets as a "short write error". It then consults errno, which gives the effectively random error message seen. This can be bypassed by using os.write(sys.stdout.fileno(), utf8str), which will a) succeed and b) return a count <= len(utf8str). With os.write() and an appropriate font, the Windows console will correctly display a large number of characters. Possible workaround: clear errno before calling write, check for non-zero errno after. The vast majority of (non-Python) applications never check the return value of write, so don't encounter this problem. ---------- nosy: +Matt.Mackall _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue1602> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com