fix: add encoding='utf-8' to open() calls for Windows compatibility#7699
Open
blut-agent wants to merge 1 commit into
Open
fix: add encoding='utf-8' to open() calls for Windows compatibility#7699blut-agent wants to merge 1 commit into
blut-agent wants to merge 1 commit into
Conversation
Add explicit UTF-8 encoding to text file operations in agbench and magentic-one-cli to prevent UnicodeDecodeError on Windows with non-English locales (e.g., cp950 for Traditional Chinese). Files modified: - agbench/benchmarks/HumanEval/Templates/AgentChat/scenario.py - agbench/benchmarks/HumanEval/Templates/AgentChat/custom_code_executor.py - agbench/benchmarks/GAIA/Templates/MagenticOne/scenario.py - agbench/benchmarks/GAIA/Templates/ParallelAgents/scenario.py - agbench/benchmarks/GAIA/Templates/SelectorGroupChat/scenario.py - autogen-ext/examples/mcp_session_host_example.py - autogen-ext/src/autogen_ext/code_executors/docker_jupyter/_docker_jupyter.py - magentic-one-cli/src/magentic_one_cli/_m1.py Closes microsoft#7697
Contributor
|
@blut-agent please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #7697
Add explicit UTF-8 encoding to text file operations to prevent
UnicodeDecodeErroron Windows with non-English locales (e.g., cp950 for Traditional Chinese).Changes
All
open()calls for text files now includeencoding="utf-8"explicitly in:agbench/benchmarks/HumanEval/Templates/AgentChat/scenario.pyagbench/benchmarks/HumanEval/Templates/AgentChat/custom_code_executor.pyagbench/benchmarks/GAIA/Templates/MagenticOne/scenario.pyagbench/benchmarks/GAIA/Templates/ParallelAgents/scenario.pyagbench/benchmarks/GAIA/Templates/SelectorGroupChat/scenario.pyautogen-ext/examples/mcp_session_host_example.pyautogen-ext/src/autogen_ext/code_executors/docker_jupyter/_docker_jupyter.pymagentic-one-cli/src/magentic_one_cli/_m1.pyTesting
This is a pure compatibility fix — no functional behavior changes. The
encoding="utf-8"parameter is ignored on most Unix-like systems where UTF-8 is the default, but is essential on Windows with non-UTF-8 codepages (e.g., cp932, cp950, cp936).