fix: add encoding="utf-8" to review_storage.py open() calls - #87
Open
nathaq wants to merge 1 commit into
Open
Conversation
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.
Hey! I noticed that
review_storage.pyhas 9open()calls that read and write JSON files without specifyingencoding="utf-8". On systems where the default locale is not UTF-8 (Windows with cp1252, minimal containers), this will either corrupt non-ASCII data silently or throwUnicodeDecodeError.The fix adds
encoding="utf-8"to every text/JSONopen()call in the file -- both reads (get_review,list_reviews,list_improvement_requests,get_improvement_request) and writes (_save_record,create_improvement_request,update_improvement_request).review_storage.pyhandles review reports, findings, and improvement request descriptions -- all of which regularly contain non-ASCII text (Chinese, accented characters, etc.), so this is especially important here.Files changed:
backend/app/storage/review_storage.py-- addedencoding="utf-8"to 9open()callsbackend/tests/test_pr_02_review_encoding.py-- round-trip tests with Chinese and accented textVerified: All 3 tests pass in the sandbox container.