siye566 f11be0a7bc
fix(sandbox): pin utf-8 decoding on the local sandbox backend's subprocess calls (#5905)
* fix(sandbox): pin utf-8 decoding on the local sandbox backend's subprocess calls

The local container backend shells out to docker / the container runtime
with text-mode subprocess calls that do not pass an encoding, so output is
decoded with the platform's preferred encoding. On hosts whose ANSI code
page is not UTF-8 (cp936 Chinese Windows, cp1252 Western European), any
non-ASCII byte in the CLI output raises inside subprocess's reader thread:
stdout/stderr come back None, the JSON-parsing call sites then crash on
None or silently mis-parse, and stderr diagnostics are dropped.

Pin encoding="utf-8" with errors="replace" on every text-mode call in
the module. The container CLIs write UTF-8 on every platform; replace
keeps the parseable portion of any non-conforming output alive instead of
discarding it wholesale.

* test(sandbox): validate UTF-8 subprocess settings per call

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-10-03 08:27:54 +08:00
..