bpo-35148: fix resetting codepage in activate.bat by moltob · Pull Request #10696 · python/cpython (original) (raw)

The current version of the Windows activate.bat activation script unfortunately does not work well in some international versions of Windows.

E.g. on a German Windows 10 version (or the bug reporter's Swiss version) the output of chcp is something like this:

Unlike the US version, the statement ends with a period, unexpected by the activation script, leading to an unsuccessful attempt to reset the codepage after venv installation. While the venv is set up correctly, the codepage is not reset. In addition a user-visible error message appears, confusing users and giving the doubt whether venv actually worked:

Parameterformat falsch - 850.

(English: "wrong parameter format")

The fix leaves the original approach in place, but deletes any periods from the CP number string, if they exist, which means it simply cleans up the CP string. This should have minimal side effects.

https://bugs.python.org/issue35148