Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inconsistent encoding in config files, among different functions ans OSs #1682

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

feddg
Copy link

@feddg feddg commented Aug 15, 2024

On Windows the default Python text encoding is cp1252, while on Unix is utf-8. This affects open(), pathlib.Path().read_text() and pathlib.Path().write_text().
This explicitly sets the encoding on all read/write operations on text files.

Before this, some function calls had an explicit encoding, other not. Such inconsistency might cause issues on Windows.

This does not introduce new tests, merely sets the explicit encoding on all function calls. A suitable test should check that all calls explicitly set the encoding. It might be easier and more robust to include the encoding in hatch.utils.fs.Path and make every read/write operation on text use that.

This also resolves #1677.

…and OSs.

On Windows the default Python text encoding is "cp1252", while on Unix is "utf-8".
This affects open(), pathlib.Path().read_text() and pathlib.Path().write_text().
This explicitly sets the encoding on all read/write operations on text files.
Before some function calls had an explicit encoding, other not.
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.

Pyproject.toml expected encoding seems inconsistent, bug with hatch test --cover and special characters
1 participant