fix: add encoding='utf-8' to file operations in task_centric_memory#7194
Open
Sean-Kenneth-Doherty wants to merge 1 commit intomicrosoft:mainfrom
Open
fix: add encoding='utf-8' to file operations in task_centric_memory#7194Sean-Kenneth-Doherty wants to merge 1 commit intomicrosoft:mainfrom
Sean-Kenneth-Doherty wants to merge 1 commit intomicrosoft:mainfrom
Conversation
This follows up on issue microsoft#5566 and PR microsoft#6094 which fixed the same issue in playwright_controller.py. The task_centric_memory module has similar file operations without explicit encoding, which can cause UnicodeDecodeError on non-English Windows systems (e.g., cp950, gbk). Files fixed: - chat_completion_client_recorder.py: session file read/write - page_logger.py: hash file, call tree HTML, and page HTML writes Without explicit encoding, Python uses the system default encoding which varies by locale (cp950 for Traditional Chinese Windows, cp936 for Simplified Chinese, etc.) and may fail to decode UTF-8 content.
Contributor
|
@Sean-Kenneth-Doherty 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.
Why are these changes needed?
Follow-up to issue #5566 and PR #6094 which fixed
encoding='utf-8'inplaywright_controller.py.The same issue exists in the
task_centric_memorymodule where file operations don't specify explicit encoding. This causesUnicodeDecodeErroron non-English Windows systems (e.g., cp950 for Traditional Chinese, cp936 for Simplified Chinese, cp932 for Japanese).Files fixed:
chat_completion_client_recorder.py: session file read/write operations (JSON that may contain non-ASCII characters)page_logger.py: hash file writes, call tree HTML, and page HTML writes (HTML content with potential non-ASCII text)Without explicit
encoding='utf-8', Python uses the system default encoding which varies by locale and can fail to handle UTF-8 content.Related issue number
Related to #5566
Checks