From f223c53218fe76f333fce65f17fcaad5917d56d5 Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Thu, 1 Oct 2015 11:27:00 +0100 Subject: [PATCH] Closes #25185: Use UTF-8 encoding when reading pyvenv.cfg. --- Lib/site.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/site.py b/Lib/site.py index ad5d136ac0e..3c8584b12a6 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -472,7 +472,9 @@ def venv(known_paths): config_line = re.compile(CONFIG_LINE) virtual_conf = candidate_confs[0] system_site = "true" - with open(virtual_conf) as f: + # Issue 25185: Use UTF-8, as that's what the venv module uses when + # writing the file. + with open(virtual_conf, encoding='utf-8') as f: for line in f: line = line.strip() m = config_line.match(line)