This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.moore
Recipients paul.moore, steve.dower, tim.golden, zach.ware
Date 2015-04-09.17:22:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1428600157.62.0.0673126456323.issue23901@psf.upfronthosting.co.za>
In-reply-to
Content
Console code page issues are a consistent source of problems on Windows. It would be nice, given that the Windows console has Unicode support, if Python could write the full range of Unicode to the console by default.

The MSVC runtime appears to have a flag that can be set via _setmode(), _O_U8TEXT, which "enables Unicode mode" (see https://msdn.microsoft.com/en-us/library/tw4k6df8%28v=vs.100%29.aspx?f=255&MSPPError=-2147217396, in particular the second example). It seems as if Python could set U8TEXT mode on sys.stdout on startup (assuming it's a console) and set the encoding to UTF8, and then Unicode output would "just work".

I don't have code that implements this yet, but if I can get my head round the IO stack and the Python startup code, I'll give it a go.

Steve - any comments on whether this might work? I've never seen any real-world code using U8TEXT which makes me wonder if it's reliable (doing msvcrt.setmode(sys.stdout.fileno(), 0x40000) in Python 3.4 causes Python to crash, which is worrying, but it works in 3.5...).
History
Date User Action Args
2015-04-09 17:22:37paul.mooresetrecipients: + paul.moore, tim.golden, zach.ware, steve.dower
2015-04-09 17:22:37paul.mooresetmessageid: <1428600157.62.0.0673126456323.issue23901@psf.upfronthosting.co.za>
2015-04-09 17:22:37paul.moorelinkissue23901 messages
2015-04-09 17:22:36paul.moorecreate