Skip to content

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

Merged
yihong0618 merged 1 commit intoPsiACE:mainfrom
glasscatya:handle-non-utf8-output
Feb 22, 2026
Merged

fix : handle non-UTF-8 output in subprocess execution#61
yihong0618 merged 1 commit intoPsiACE:mainfrom
glasscatya:handle-non-utf8-output

Conversation

@glasscatya
Copy link
Contributor

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

@glasscatya
Copy link
Contributor 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.

…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 glasscatya force-pushed the handle-non-utf8-output branch from 9109db5 to 4a5b7dd Compare February 21, 2026 09:29
@yihong0618 yihong0618 merged commit 9c04aea into PsiACE:main Feb 22, 2026
5 checks passed
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

2 participants