Conversation
On Windows with CJK locales (e.g. Chinese/GBK), pathlib.Path.read_text() defaults to the system encoding instead of UTF-8, causing UnicodeDecodeError when reading .env or .json config files that contain non-ASCII characters. Explicitly pass encoding='utf-8' to all read_text() and write_text() calls in the hindsight memory provider plugin.
Collaborator
|
Thanks for the targeted Windows compatibility fix. The premise is confirmed on current Problems
Suggested changes
This is an automated hermes-sweeper review. |
Collaborator
|
Merged via PR #71078 — your commit(s) were cherry-picked onto current main with your authorship preserved in git log (rebase merge). This PR was part of the class-wide close-out of bare |
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
On Windows with CJK system locales (e.g. Chinese GBK),
pathlib.Path.read_text()defaults to the system encoding instead of UTF-8. This causes aUnicodeDecodeErrorwhen the hindsight memory provider reads.envor JSON config files containing non-ASCII characters.Fix
Explicitly pass
encoding="utf-8"to all 3read_text()and 1write_text()calls inplugins/memory/hindsight/__init__.pythat handle.envand JSON config files.This is consistent with the existing
write_text(..., encoding="utf-8")call already present at line 556 in the same file.Affected lines
config_path.read_text()→read_text(encoding="utf-8")env_path.read_text()→read_text(encoding="utf-8")env_path.read_text()→read_text(encoding="utf-8")env_path.write_text(...)→write_text(..., encoding="utf-8")Environment