Skip to content

fix: specify UTF-8 encoding for text file operations#167

Merged
krisztianfekete merged 4 commits into
agentevals-dev:mainfrom
AaronProbha18:fix/enforce-utf-encoding
Jul 8, 2026
Merged

fix: specify UTF-8 encoding for text file operations#167
krisztianfekete merged 4 commits into
agentevals-dev:mainfrom
AaronProbha18:fix/enforce-utf-encoding

Conversation

@AaronProbha18

Copy link
Copy Markdown
Contributor

Summary

This PR updates all text-mode file operations to explicitly specify encoding="utf-8" when opening files.

Previously, open() relied on the platform's default encoding, which varies across operating systems (for example, UTF-8 on most Unix-based systems versus legacy code pages on Windows). This inconsistency was causing pytest failures on Windows.

Changes

  • Added encoding="utf-8" to all text-mode open() calls used for reading and writing files.
  • Left binary-mode ("rb"/"wb") file operations unchanged.

@krisztianfekete krisztianfekete left a comment

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.

Please also cover the migration logic in cli.py, and others in sinks.py, sources.py, and venv.py so the we really cover all text mode operations.

@AaronProbha18

Copy link
Copy Markdown
Contributor Author

Please also cover the migration logic in cli.py, and others in sinks.py, sources.py, and venv.py so the we really cover all text mode operations.

I think have covered all the text operations and enforced UTF-8 encoding, please let me know if I missed anything

Comment thread src/agentevals/streaming/ws_server.py Outdated

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.

Please enforce encoding here and in mcp_server.py as well.

@krisztianfekete krisztianfekete merged commit aec97b2 into agentevals-dev:main Jul 8, 2026
5 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