You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Uses explicit UTF-8 encoding for the Copilot ACP fs/read_text_file and fs/write_text_file shim so non-ASCII text is handled consistently even when the platform default encoding is not UTF-8.
🐛 Bug fix (non-breaking change that fixes an issue)
✅ Tests (adding or improving test coverage)
Changes Made
Updated agent/copilot_acp_client.py to pass encoding="utf-8" for ACP text file reads/writes.
Added a regression test in tests/agent/test_copilot_acp_client.py that simulates a cp1252 default encoding and verifies non-ASCII content is written/read as UTF-8.
Thanks for the focused regression fix. The premise remains valid on current main: agent/copilot_acp_client.py:706 still calls path.read_text() without an encoding for fs/read_text_file, and agent/copilot_acp_client.py:735 does the same for path.write_text(...) in fs/write_text_file.
The PR commit 020aeef5873d3b3817524888324adcdf182c93e3 changes both exact handlers to explicit UTF-8 and its added test drives both ACP JSON-RPC methods through the existing dispatch helper under a simulated cp1252 default. A repository-wide search found these ACP file-method strings only in this shim and its focused test, so there is no unaddressed sibling ACP handler.
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
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.
What does this PR do?
Uses explicit UTF-8 encoding for the Copilot ACP
fs/read_text_fileandfs/write_text_fileshim so non-ASCII text is handled consistently even when the platform default encoding is not UTF-8.Fixes #38119
Type of Change
Changes Made
agent/copilot_acp_client.pyto passencoding="utf-8"for ACP text file reads/writes.tests/agent/test_copilot_acp_client.pythat simulates a cp1252 default encoding and verifies non-ASCII content is written/read as UTF-8.How to Test
scripts/run_tests.sh tests/agent/test_copilot_acp_client.py.venv/bin/ruff check agent/copilot_acp_client.py tests/agent/test_copilot_acp_client.pyVerification
scripts/run_tests.sh tests/agent/test_copilot_acp_client.py: 8/8 passed.venv/bin/ruff check agent/copilot_acp_client.py tests/agent/test_copilot_acp_client.py: All checks passedgit diff --check: no whitespace errors