Encoding Problems On Windows With Python Redirecting From Console

22 views
Skip to first unread message

Thomas Passin

unread,
Nov 13, 2022, 3:51:06 PM11/13/22
to leo-editor
On Windows, if you redirect console output to a file or pipe, and if there are non-ascii unicode characters in your output, you may get failure with an error message about the wrong code page.  The reason is obscure, and discussed here with solutions:


tl;dr - When you redirect the output, Windows uses the system locale encoding instead of the console encoding.  Even if the console encoding is 65001 (quasi-utf-8), the local encoding is probably using still using cp1252 (ascii) or similar.  Windows 11 may have a different behavior.

Edward K. Ream

unread,
Nov 14, 2022, 4:07:53 AM11/14/22
to leo-editor
Thanks for this report. Please feel free to file an issue for this. It could have the "Info", "Bug" and "Can'tFix" labels :-)

Edward
Reply all
Reply to author
Forward
0 new messages