fix: add explicit utf-8 encoding to file open calls#7480
Open
IgnazioDS wants to merge 1 commit intomicrosoft:mainfrom
Open
fix: add explicit utf-8 encoding to file open calls#7480IgnazioDS wants to merge 1 commit intomicrosoft:mainfrom
IgnazioDS wants to merge 1 commit intomicrosoft:mainfrom
Conversation
Add encoding='utf-8' to open() calls across the codebase to prevent UnicodeDecodeError on non-English Windows systems where the default encoding is not UTF-8 (e.g., CP950 for Traditional Chinese). Files fixed: - magentic-one-cli/_m1.py (config file reading) - autogen-ext/code_executors/docker_jupyter/_docker_jupyter.py (HTML writing) - autogen-studio/database/schema_manager.py (alembic config read/write) - autogen-studio/web/auth/manager.py (YAML config reading) - autogen-studio/lite/studio.py (env file writing) - autogen-studio/cli.py (env file writing) - autogen-studio/gallery/builder.py (JSON file writing) - agbench run_cmd.py, tabulate_cmd.py, remove_missing_cmd.py (log/config reading) - agbench linter cli.py and oai_coder.py (file read/write) - agbench benchmarks process_logs.py, custom_tabulate.py (log reading) - fixup_generated_files.py (generated file read/write) Fixes microsoft#5566
Author
|
@microsoft-github-policy-service agree |
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
encoding='utf-8'toopen()calls across the codebase (15 files)playwright_controller.py(line 67) was already merged in PR add utf encoding in websurfer read file #6094, but the issue remains open because similar missing encoding parameters exist throughout the codebaseUnicodeDecodeErroron non-English Windows systems (e.g., CP950 for Traditional Chinese)Problem
On Windows systems with non-UTF-8 default encoding,
open()without explicit encoding crashes withUnicodeDecodeError: 'cp950' codec can't decode byte. See #5566.Changes
magentic-one-cli:
_m1.py— config file readingautogen-ext:
docker_jupyter/_docker_jupyter.py— HTML file writingautogen-studio:
database/schema_manager.py— alembic config read/write (7 calls)web/auth/manager.py— YAML config readinglite/studio.py— env file writingcli.py— env file writinggallery/builder.py— JSON file writingagbench:
run_cmd.py— env/config file reading (4 calls)tabulate_cmd.py— console log reading (2 calls)remove_missing_cmd.py— console log readinglinter/cli.py— log file readinglinter/coders/oai_coder.py— cache file read/writebenchmarks/process_logs.py— log/prompt file reading (8 calls)benchmarks/GAIA/Scripts/custom_tabulate.py— answer/log file readingOther:
fixup_generated_files.py— generated file read/writeTest plan
Fixes #5566