Skip to content

fix : handle non-UTF-8 output in subprocess execution#61

Open
glasscatya wants to merge 1 commit intoPsiACE:mainfrom
glasscatya:handle-non-utf8-output
Open

fix : handle non-UTF-8 output in subprocess execution#61
glasscatya wants to merge 1 commit intoPsiACE:mainfrom
glasscatya:handle-non-utf8-output

Conversation

@glasscatya
Copy link

Related Issue

Fixes #60

Modification

Use errors="replace" when decoding stdout/stderr in run_bash to prevent UnicodeDecodeError.

Tests

  • Existing tests: All just test passed
  • Formatting check: just check passed
  • Manual verification: GBK-encoded output no longer triggers UnicodeDecodeError in Windows + WSL

Code Quality Checks

  • ruff check . passed
  • pytest all tests passed

…tdout/stderr with errors="replace" to prevent UnicodeDecodeError on non-UTF-8 encoded output (e.g., GBK)- Add test case verifying GBK-encoded Chinese characters are handled gracefully with replacement characters (�)
@glasscatya
Copy link
Author

Additional Notes

This change aligns with the existing web.fetch utility in the project (see builtin.py line 269),
consistently using errors="replace" to handle potential non-UTF-8 external input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: UnicodeDecodeError when subprocess output contains non-UTF-8 characters

1 participant