diff --git a/docs/html/reference/pip_install.rst b/docs/html/reference/pip_install.rst index ac37455ccad..780e06242b5 100644 --- a/docs/html/reference/pip_install.rst +++ b/docs/html/reference/pip_install.rst @@ -148,6 +148,8 @@ and the newline following it is effectively ignored. Comments are stripped *before* line continuations are processed. +To interpret the requirements file in UTF-8 format add a comment ``# -*- coding: utf-8 -*-`` to the first or second line of the file. + The following options are supported: * :ref:`-i, --index-url <--index-url>` diff --git a/news/7182.doc b/news/7182.doc new file mode 100644 index 00000000000..f55c6ee7eef --- /dev/null +++ b/news/7182.doc @@ -0,0 +1 @@ +Document that "coding: utf-8" is supported in requirements.txt diff --git a/src/pip/_internal/download.py b/src/pip/_internal/download.py index 6567fc375a6..6da046b2a4f 100644 --- a/src/pip/_internal/download.py +++ b/src/pip/_internal/download.py @@ -85,7 +85,9 @@ def get_file_content(url, comes_from=None, session=None): # type: (str, Optional[str], Optional[PipSession]) -> Tuple[str, Text] """Gets the content of a file; it may be a filename, file: URL, or - http: URL. Returns (location, content). Content is unicode. + http: URL. Returns (location, content). Default encoding of content is + unicode. To use utf-8 encoding use encoding declaration in first or + second line of requirements file :param url: File path or url. :param comes_from: Origin description of requirements.