Fix encoding issues in text file operations for non-English Windows systems#7238
Open
paipeline wants to merge 1 commit intomicrosoft:mainfrom
Open
Fix encoding issues in text file operations for non-English Windows systems#7238paipeline wants to merge 1 commit intomicrosoft:mainfrom
paipeline wants to merge 1 commit intomicrosoft:mainfrom
Conversation
- Add explicit encoding='utf-8' to open() calls for text files - Fixes UnicodeDecodeError on non-English Windows systems (issue microsoft#5566) - Updated YAML config files, prompt files, and test utilities - Ensures consistent UTF-8 handling across platforms Files affected: - autogen-ext/tests/task_centric_memory/utils.py - agbench HumanEval/AgentChat scenario.py - agbench GAIA/MagenticOne scenario.py - agbench GAIA/SelectorGroupChat scenario.py This addresses the root cause where Windows systems with non-English locales (like CP950 Chinese) would fail when reading files containing non-ASCII characters.
Contributor
|
@paipeline 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.
Problem
This PR addresses issue #5566 where AutoGen fails on non-English Windows systems with UnicodeDecodeError when reading text files. While the specific playwright_controller.py file mentioned in the issue was already fixed in PR #6094, this issue highlighted a broader pattern of missing encoding specifications in file operations throughout the codebase.
Root Cause
On Windows systems with non-English locales (e.g., CP950 for Chinese, CP932 for Japanese), Python's default encoding for open() is not UTF-8. When files contain non-ASCII characters, this causes UnicodeDecodeError crashes.
Solution
Added explicit encoding='utf-8' parameter to open() calls for text files that:
Files Fixed
Impact
Testing
All changes are syntactically verified. The fix ensures consistent UTF-8 handling across platforms, preventing locale-specific encoding issues.
Closes #5566