Eryk Sun <[email protected]> added the comment:
The CMD shell decodes batch scripts using the attached console's output
codepage, which defaults to OEM. OTOH, venv writes the replacement values for
the template activate.bat as UTF-8 (codepage 65001), which is correct and
should not be downgraded to OEM.
Instead, the batch script could temporarily switch the console to codepage
65001. Then restore the previous codepage at the end. For example:
@echo off
for /f "tokens=2 delims=:" %%a in ('"%SystemRoot%\System32\chcp.com"') do (
set "CODEPAGE=%%a"
)
"%SystemRoot%\System32\chcp.com" 65001 > nul
[rest of script]
"%SystemRoot%\System32\chcp.com" %CODEPAGE% > nul
set "CODEPAGE="
:END
----------
components: +Library (Lib), Unicode, Windows -Extension Modules
nosy: +eryksun, ezio.melotti, paul.moore, steve.dower, tim.golden, vstinner,
zach.ware
stage: -> needs patch
title: venv activation doesn't work, if project is in a Windows folder that has
latin-1 supplement characters (such as ä,ö,å) in its path -> venv activate.bat
is UTF-8 encoded but uses current console codepage
versions: +Python 3.7
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue32409>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com