bpo-32409 Ensures activate.bat can handle Unicode contents by samstagern · Pull Request #10295 · python/cpython

eryksun

eryksun

eryksun

vsajip

eryksun

@samstagern

…thonGH-10295)

Handle Unicode contents on localized Windows systems when activating a
virtualenv. activate.bat currently breaks on German Windows systems as chcp does
not return a plain number as on English systems, but appends a dot at the end
(for example "Aktive Codepage: 850." instead of "Active Codepage: 850). The
dependency to chcp.com is removed and ctypes is used to get, set and restore the
console ouput codepage. The codepage for console input is not changed.

We can't use __VENV_PYTHON__ to find python.exe since it's UTF-8. CMD decodes
the script using the console output codepage.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Nov 7, 2018
…ythonGH-10295)

Handle Unicode contents on localised Windows systems when activating a
venv. activate.bat currently breaks on German Windows systems, as chcp.com does
not return a plain number as on English systems, but (arbitrarily) appends a dot at the end
(for example "Aktive Codepage: 850." instead of "Active Codepage: 850"). The
dependency to chcp.com is removed and ctypes is used to get, set and restore the
console output code page. The code page for console input is not changed.

We can't use __VENV_PYTHON__ to find python.exe, since it's UTF-8. cmd.exe decodes
the script using the console output code page.
(cherry picked from commit c64583b)

Co-authored-by: samstagern <30337691+samstagern@users.noreply.github.com>

vsajip pushed a commit that referenced this pull request

Nov 7, 2018
…H-10295) (GH-10377)

Handle Unicode contents on localised Windows systems when activating a
venv. activate.bat currently breaks on German Windows systems, as chcp.com does
not return a plain number as on English systems, but (arbitrarily) appends a dot at the end
(for example "Aktive Codepage: 850." instead of "Active Codepage: 850"). The
dependency to chcp.com is removed and ctypes is used to get, set and restore the
console output code page. The code page for console input is not changed.

We can't use __VENV_PYTHON__ to find python.exe, since it's UTF-8. cmd.exe decodes
the script using the console output code page.
(cherry picked from commit c64583b)

Co-authored-by: samstagern <30337691+samstagern@users.noreply.github.com>

pablogsal added a commit to pablogsal/cpython that referenced this pull request

Nov 7, 2018

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Nov 7, 2018

pablogsal added a commit that referenced this pull request

Nov 7, 2018

miss-islington added a commit that referenced this pull request

Nov 8, 2018
…ndows (GH-10295)" (GH-10403)

This reverts commit c64583b due to multiple buildbot failures when building it.
(cherry picked from commit 6843ffe)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>

eryksun