fix(gateway): add explicit encoding to read_text/write_text calls - #51119
fix(gateway): add explicit encoding to read_text/write_text calls#51119AlexFucuson9 wants to merge 1 commit into
Conversation
Add encoding='utf-8' to all read_text() and write_text() calls in gateway/. Path.read_text() defaults to system locale (cp1252 on Windows), causing UnicodeDecodeError for UTF-8 JSON configs and user data. Files changed: - gateway/run.py (20 calls) - gateway/status.py (1 call) - gateway/delivery.py (2 calls) - gateway/slash_commands.py (1 call) - gateway/platforms/qqbot/adapter.py (1 call) Ruff rule PLW1514.
|
Thanks for addressing the Windows-sensitive default-encoding behavior. The exact calls changed by this PR are still bare Problems
Suggested changes
The PR base predates substantial movement in these files, but the target calls remain present on current main. This is an automated hermes-sweeper review. |
|
Closing as resolved by PR #71078 (merged, commit d372fda): the class-wide close-out salvaged your #50655/#54241/#56385/#66856/#65440 series as the backbone (authorship preserved in git log) and swept the remaining sites, so every read_text/write_text call this PR touches is now guarded on current main — verified per-site. A CI linter rule in check-windows-footguns.py plus the AST guard test now prevent regressions. Your overlapping/split variants of the same series are being closed together; the credit for the class rests on your commits. |
Summary
Add explicit
encoding='utf-8'to allread_text()andwrite_text()calls ingateway/.Path.read_text()defaults to system locale (cp1252 on Windows), causing UnicodeDecodeError for UTF-8 JSON configs and user data.Files changed (5 files, 25 calls)
Test plan
Ruff rule PLW1514.