fix(windows): force UTF-8 in channel subprocesses and MCP server env (#345)
Extracted from #318 (the UTF-8/doctor core, minus the env-wrapper feature): - new agent_reach/utils/process.py: utf8_subprocess_env() + mcporter_utf8_env_args() — Windows GBK consoles otherwise corrupt Chinese output from mcporter/MCP child processes - weibo/douyin/linkedin checks and weibo install/registration now pass the UTF-8 env (and register the MCP server with --env PYTHONUTF8=1) - youtube: extract _has_js_runtime_config() with an OSError guard so an unreadable yt-dlp config can't crash doctor - test_skill_command: open SKILL.md with explicit utf-8 (Windows GBK default broke these tests) Co-authored-by: chidao <2980933590@qq.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
from agent_reach.utils.process import mcporter_utf8_env_args, utf8_subprocess_env
|
||||
|
||||
|
||||
def test_utf8_subprocess_env_forces_python_utf8():
|
||||
env = utf8_subprocess_env({"PYTHONUTF8": "0", "OTHER": "value"})
|
||||
|
||||
assert env["PYTHONUTF8"] == "1"
|
||||
assert env["PYTHONIOENCODING"] == "utf-8"
|
||||
assert env["OTHER"] == "value"
|
||||
|
||||
|
||||
def test_mcporter_utf8_env_args():
|
||||
assert mcporter_utf8_env_args() == [
|
||||
"--env",
|
||||
"PYTHONUTF8=1",
|
||||
"--env",
|
||||
"PYTHONIOENCODING=utf-8",
|
||||
]
|
||||
Reference in New Issue
Block a user