Skip to content

fix: force utf-8 encoding on all text file reads/writes - #278

Merged
RalfG merged 1 commit into
mainfrom
fix/explicit-utf8-encoding
Sep 7, 2026
Merged

fix: force utf-8 encoding on all text file reads/writes#278
RalfG merged 1 commit into
mainfrom
fix/explicit-utf8-encoding

Conversation

@RalfG

@RalfG RalfG commented Aug 1, 2026

Copy link
Copy Markdown
Member

Several read_text()/open() calls relied on the platform's default encoding (locale-dependent), which breaks on ASCII-locale systems (e.g. bioconda's Linux test env, UnicodeDecodeError on texts.toml) and mis-encodes on non-UTF-8 Windows locales (e.g. French cp1252).

@RalfG RalfG added the bug label Aug 1, 2026
@RalfG RalfG added this to the v4.0.2 milestone Aug 1, 2026
@RalfG
RalfG requested a review from paretje August 1, 2026 10:57
Several read_text()/open() calls relied on the platform's default
encoding (locale-dependent), which breaks on ASCII-locale systems
(e.g. bioconda's Linux test env, UnicodeDecodeError on texts.toml)
and mis-encodes on non-UTF-8 Windows locales (e.g. French cp1252).
Comment thread ms2rescore/core.py

# Write full configuration including defaults to file
with open(output_file_root + ".full-config.json", "w") as f:
with open(output_file_root + ".full-config.json", "w", encoding="utf-8") as f:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to do this for the other output files as well?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it would for consistency. Would it make sense from an end-user perspective?

@RalfG
RalfG merged commit ce7d56d into main Sep 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants