Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-32409: Ensures activate.bat can handle Unicode contents #5757

Merged
merged 2 commits into from
Feb 20, 2018

Conversation

zooba
Copy link
Member

@zooba zooba commented Feb 19, 2018

@@ -30,3 +39,7 @@ if defined _OLD_VIRTUAL_PATH (
set "PATH=%VIRTUAL_ENV%\__VENV_BIN_NAME__;%PATH%"

:END
if defined _OLD_CODEPAGE (
"%SystemRoot%\System32\chcp.com" %_OLD_CODEPAGE% > nul
set _OLD_CODEPAGE=
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you did above, there should be quotes around the assignment, just in case there's any white space at the end, e.g. set "_OLD_CODEPAGE=".

@zooba zooba merged commit 6240917 into python:master Feb 20, 2018
@miss-islington
Copy link
Contributor

Thanks @zooba for the PR 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7.
🐍🍒⛏🤖

@zooba zooba deleted the bpo-32409 branch February 20, 2018 01:25
@bedevere-bot
Copy link

GH-5765 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 20, 2018
@bedevere-bot
Copy link

GH-5766 is a backport of this pull request to the 3.6 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 20, 2018
@samstagern
Copy link
Contributor

This does not work on German systems:

We had to revert to Python 3.6, because of this as it will not work on German (or Swiss German) Windows systems:

activate.bat breaks on German systems as chcp does not return a plain number. Note the dot at the end:

chcp
Aktive Codepage: 850.

This leads to

for /F "tokens=2 delims=:" %a in ('"C:\WINDOWS\System32\chcp.com"') do (echo "%a" )
(echo " 850." )
" 850."

Fortunately it is easy to extract the number from there

for /f "tokens=2 delims=:" %%a in ('"%SystemRoot%\System32\chcp.com"') do (
echo "%%a"
for %%F in ("%%a") do set "_OLD_CODEPAGE=%%~nxF"
echo %_OLD_CODEPAGE%
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS-windows type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants