From b3fca6c715eeb4c55ce5a2e94642a605324cab4b Mon Sep 17 00:00:00 2001 From: escalate007 <55056146+escalate007@users.noreply.github.com> Date: Mon, 20 Jul 2026 15:55:42 +0800 Subject: [PATCH] fix(tui_gateway): set utf-8 encoding for subprocess pipes on Windows On Chinese Windows systems, subprocess.Popen with text=True defaults to GBK encoding for pipe reads. When the Hermes backend writes UTF-8 bytes to stderr, the _drain_stderr thread crashes with UnicodeDecodeError, making the desktop UI unresponsive after file uploads. Fix by adding encoding='utf-8' to the Popen call. --- tui_gateway/server.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tui_gateway/server.py b/tui_gateway/server.py index 801f855910cae..cd329eaad6fc2 100644 --- a/tui_gateway/server.py +++ b/tui_gateway/server.py @@ -337,6 +337,7 @@ def __init__(self, session_key: str, model: str, profile_home: str | None = None stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, + encoding='utf-8', bufsize=1, cwd=os.getcwd(), env=env,