gh-86427: Use the console code page for the stdio encoding on Windows… · python/cpython@0bb312a · GitHub
Skip to content

Commit 0bb312a

Browse files
gh-86427: Use the console code page for the stdio encoding on Windows (GH-155415)
In the legacy Windows stdio mode PyConfig.stdio_encoding is now initialized with the console output code page instead of the ANSI code page. Only one encoding can be specified, so sys.stdin.encoding is still wrong if the input code page differs from the output one.
1 parent 0c38e05 commit 0bb312a

3 files changed

Lines changed: 62 additions & 2 deletions

File tree

Lib/test/test_cmd_line.py

Lines changed: 35 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix the encoding of the standard streams in the legacy Windows stdio mode
2+
(:envvar:`PYTHONLEGACYWINDOWSSTDIO`). It is now the code page of the
3+
console, as in Python 3.7, not the ANSI code page.

Python/initconfig.c

Lines changed: 24 additions & 2 deletions

0 commit comments

Comments
 (0)