Skip to content

Commit

Permalink
fixup! Reorder requirements file decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewhughes934 committed Dec 26, 2024
1 parent 60c6bb9 commit 5c49381
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions docs/html/reference/requirements-file-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,14 @@ examples of all these forms, see {ref}`pip install Examples`.

### Encoding

It is simplest to encode your requirements files with UTF-8.
The process for decoding requirements files is:

- Check for any Byte Order Mark at the start of the file and if found use
the corresponding encoding to decode the file.
- Check for any {pep}`263` style comment (e.g. `# -*- coding: <encoding name> -*-`)
and if found decode with the given encoding.
- Try and decode with UTF-8, and if that fails,
- fallback to trying to decode using the locale defined encoding.
The default encoding for requirement files is `UTF-8` unless a different
encoding is specified using a {pep}`263` style comment (e.g. `# -*- coding:
<encoding name> -*-`).

```{warning}
pip will fallback to the locale defined encoding if `UTF-8` decoding fails. This is a quirk
of pip's parser. This behaviour is *deprecated* and should not be relied upon.
```

### Line continuations

Expand Down

0 comments on commit 5c49381

Please sign in to comment.