Skip to content

Commit 09cd649

Browse files
authored
Merge pull request #5482 from ambv/utf8fun
Open pyproject.toml with UTF-8 encoding in all environments
2 parents 2af3285 + 8a7e5fb commit 09cd649

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

news/5482.bugfix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Always read ``pyproject.toml`` as UTF-8. This fixes Unicode handling on Windows and Python 2.

src/pip/_internal/req/req_install.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import absolute_import
22

3+
import io
34
import logging
45
import os
56
import re
@@ -444,7 +445,7 @@ def get_pep_518_info(self):
444445
requirements, pip will default to installing setuptools and wheel.
445446
"""
446447
if os.path.isfile(self.pyproject_toml):
447-
with open(self.pyproject_toml) as f:
448+
with io.open(self.pyproject_toml, encoding="utf-8") as f:
448449
pp_toml = pytoml.load(f)
449450
build_sys = pp_toml.get('build-system', {})
450451
return (build_sys.get('requires', ['setuptools', 'wheel']), True)
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
[build-system]
22
requires = ["setuptools", "wheel"]
3+
4+
# Note: pyproject.toml is always UTF-8 🤡

0 commit comments

Comments
 (0)