Skip to content

Read the Pipfile as UTF-8 in check, scan and --support - #6779

Merged
matteius merged 1 commit into
pypa:mainfrom
b84330808:fix-check-scan-support-pipfile-encoding
Nov 5, 2026
Merged

matteius merged 1 commit into
pypa:mainfrom
b84330808:fix-check-scan-support-pipfile-encoding

Conversation

@b84330808

Copy link
Copy Markdown
Contributor

The issue

Follow-up to #6756. pipenv check, pipenv scan and pipenv --support still open the Pipfile (and --support also Pipfile.lock) with the locale encoding. On Windows with a legacy code page, a Pipfile with any non-ASCII text, even a comment, makes them fail:

UnicodeDecodeError: 'cp932' codec can't decode byte 0x82 in position 25: illegal multibyte sequence

A Pipfile saved with a BOM breaks check and scan on every platform (EmptyKeyError: Empty key at line 1 col 0).

The fix

Open them as utf-8-sig, like the other Pipfile and lockfile readers. The new cases in tests/unit/test_pipfile_encoding.py fail without the change (all of them on cp932; the BOM cases under -X utf8).

The checklist

  • Associated issue
  • A news fragment in the news/ directory to describe this fix with the extension .bugfix.rst, .feature.rst, .behavior.rst, .doc.rst. .vendor.rst. or .trivial.rst (this will appear in the release changelog). Use semantic line breaks and name the file after the issue number or the PR #.

@matteius
matteius merged commit ef75aa0 into pypa:main Nov 5, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants