From 8516324f84d631369ebc7cf05d9d16b7705150a9 Mon Sep 17 00:00:00 2001 From: Icather <97326386+Icather@users.noreply.github.com> Date: Fri, 24 Jul 2026 13:49:16 -0700 Subject: [PATCH] fix(tools): utf-8 decode for STT/TTS command-provider popen_kwargs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Salvaged from PR #45099 — the two popen_kwargs dict sites the #70875 AST sweep missed because the kwargs are built indirectly (_run_command_stt, _run_command_tts). --- tools/transcription_tools.py | 4 ++++ tools/tts_tool.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/tools/transcription_tools.py b/tools/transcription_tools.py index 1198f53d13..dd8c60275a 100644 --- a/tools/transcription_tools.py +++ b/tools/transcription_tools.py @@ -556,6 +556,10 @@ def _run_command_stt(command: str, timeout: float) -> subprocess.CompletedProces "stdout": subprocess.PIPE, "stderr": subprocess.PIPE, "text": True, + # Lossy UTF-8 decode — locale-mismatched bytes from the STT command + # must not raise in the reader threads on non-UTF-8 Windows (#45099). + "encoding": "utf-8", + "errors": "replace", "env": delegated_child_subprocess_env(), } if os.name == "nt": diff --git a/tools/tts_tool.py b/tools/tts_tool.py index 27c761e17c..446a04aa58 100644 --- a/tools/tts_tool.py +++ b/tools/tts_tool.py @@ -782,6 +782,10 @@ def _run_command_tts(command: str, timeout: float) -> subprocess.CompletedProces "stdout": subprocess.PIPE, "stderr": subprocess.PIPE, "text": True, + # Lossy UTF-8 decode — locale-mismatched bytes from the TTS command + # must not raise in the reader threads on non-UTF-8 Windows (#45099). + "encoding": "utf-8", + "errors": "replace", "env": delegated_child_subprocess_env(), } if os.name == "nt":