File tree 2 files changed +8
-1
lines changed
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ def _version_info(exe: str) -> str:
36
36
37
37
def _read_pyvenv_cfg (filename : str ) -> Dict [str , str ]:
38
38
ret = {}
39
- with open (filename ) as f :
39
+ with open (filename , encoding = 'UTF-8' ) as f :
40
40
for line in f :
41
41
try :
42
42
k , v = line .split ('=' )
Original file line number Diff line number Diff line change @@ -23,6 +23,13 @@ def test_read_pyvenv_cfg(tmpdir):
23
23
assert python ._read_pyvenv_cfg (pyvenv_cfg ) == expected
24
24
25
25
26
+ def test_read_pyvenv_cfg_non_utf8 (tmpdir ):
27
+ pyvenv_cfg = tmpdir .join ('pyvenv_cfg' )
28
+ pyvenv_cfg .write_binary ('hello = hello john.š\n ' .encode ())
29
+ expected = {'hello' : 'hello john.š' }
30
+ assert python ._read_pyvenv_cfg (pyvenv_cfg ) == expected
31
+
32
+
26
33
def test_norm_version_expanduser ():
27
34
home = os .path .expanduser ('~' )
28
35
if os .name == 'nt' : # pragma: nt cover
You can’t perform that action at this time.
0 commit comments