From 75a2213510c28ea9ed9d32d5ff408b92d81254c1 Mon Sep 17 00:00:00 2001 From: Pnant <73925474+Panniantong@users.noreply.github.com> Date: Sat, 7 Mar 2026 12:58:18 +0800 Subject: [PATCH] fix: remove isatty guard in _ensure_utf8_console (#95) (#101) The isatty() check skipped UTF-8 wrapping when agent-reach was called as a subprocess by AI agents (non-TTY). On Windows with GBK encoding, any remaining non-ASCII chars would crash with UnicodeEncodeError. Now UTF-8 wrapping applies in all environments on Windows. Closes #95 Co-authored-by: Panniantong --- agent_reach/cli.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/agent_reach/cli.py b/agent_reach/cli.py index d4123a7..6de350e 100644 --- a/agent_reach/cli.py +++ b/agent_reach/cli.py @@ -25,8 +25,6 @@ def _ensure_utf8_console(): # Avoid interfering with pytest/captured streams. if os.environ.get("PYTEST_CURRENT_TEST"): return - if not getattr(sys.stdout, "isatty", lambda: False)(): - return try: import io if hasattr(sys.stdout, "buffer"):