Skip to content

Commit aa7820c

Browse files
committed
Document that "coding: utf-8" is supported in requirements.txt
Fixes pypa#7182
1 parent a0b75cc commit aa7820c

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

docs/html/reference/pip_install.rst

+2
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ and the newline following it is effectively ignored.
148148

149149
Comments are stripped *before* line continuations are processed.
150150

151+
To interpret the requirements file in UTF-8 format add a comment ``# -*- coding: utf-8 -*-`` to the first or second line of the file.
152+
151153
The following options are supported:
152154

153155
* :ref:`-i, --index-url <--index-url>`

news/7182.doc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Document that "coding: utf-8" is supported in requirements.txt

src/pip/_internal/download.py

+3
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ def get_file_content(url, comes_from=None, session=None):
122122

123123
try:
124124
with open(url, 'rb') as f:
125+
# Decode the encoding format
126+
# Example: Following comment enables utf-8 format
127+
# # -*- coding: utf-8 -*-
125128
content = auto_decode(f.read())
126129
except IOError as exc:
127130
raise InstallationError(

0 commit comments

Comments
 (0)