summaryrefslogtreecommitdiffstats
path: root/Lib/venv/scripts
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-02-20 02:18:43 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2018-02-20 02:18:43 (GMT)
commit8e149ff481acbb3889c825b8bf7b10aa191f09a7 (patch)
tree97c994f4085daa886d5ae0c47ac469af61fce229 /Lib/venv/scripts
parentef0bb5c7b76a49a5f3c5b85b5f9112cfefe54328 (diff)
downloadcpython-8e149ff481acbb3889c825b8bf7b10aa191f09a7.zip
cpython-8e149ff481acbb3889c825b8bf7b10aa191f09a7.tar.gz
cpython-8e149ff481acbb3889c825b8bf7b10aa191f09a7.tar.bz2
bpo-32409: Ensures activate.bat can handle Unicode contents (GH-5766)
(cherry picked from commit 6240917b773b52f8883387b9e3a5f327a4372068) Co-authored-by: Steve Dower <steve.dower@microsoft.com>
Diffstat (limited to 'Lib/venv/scripts')
-rw-r--r--Lib/venv/scripts/nt/activate.bat13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/venv/scripts/nt/activate.bat b/Lib/venv/scripts/nt/activate.bat
index d76ca13..126049f 100644
--- a/Lib/venv/scripts/nt/activate.bat
+++ b/Lib/venv/scripts/nt/activate.bat
@@ -1,4 +1,13 @@
@echo off
+
+rem This file is UTF-8 encoded, so we need to update the current code page while executing it
+for /f "tokens=2 delims=:" %%a in ('"%SystemRoot%\System32\chcp.com"') do (
+ set "_OLD_CODEPAGE=%%a"
+)
+if defined _OLD_CODEPAGE (
+ "%SystemRoot%\System32\chcp.com" 65001 > nul
+)
+
set "VIRTUAL_ENV=__VENV_DIR__"
if not defined PROMPT (
@@ -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="
+)