From f06226ed94a2dc6befb425af0dd9188b535df932 Mon Sep 17 00:00:00 2001 From: drknowhow Date: Sun, 14 Jun 2026 07:52:06 -0400 Subject: [PATCH] fix: force UTF-8 console so Oracle server starts on Windows cp1252 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit run_oracle printed a '→' in its startup banner, which crashed with UnicodeEncodeError on Windows consoles/pipes using the cp1252 code page (observed on Python 3.14), so the server never finished booting. Added _force_utf8_console(), called first in run_oracle, to reconfigure stdout/stderr to UTF-8 (errors="replace") — covering both startup banners and the logging StreamHandler. Verified the server now boots without the PYTHONIOENCODING=utf-8 workaround. Co-Authored-By: Claude Opus 4.8 (1M context) --- oracle/oracle_server.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/oracle/oracle_server.py b/oracle/oracle_server.py index 145f43a..db66d35 100644 --- a/oracle/oracle_server.py +++ b/oracle/oracle_server.py @@ -825,8 +825,19 @@ def _is_oracle_running(port: int) -> bool: return False +def _force_utf8_console() -> None: + """Make stdout/stderr UTF-8 so banner/log output can't crash on legacy + Windows code pages (cp1252 raises UnicodeEncodeError on chars like '→').""" + for stream in (sys.stdout, sys.stderr): + try: + stream.reconfigure(encoding="utf-8", errors="replace") + except (AttributeError, ValueError, OSError): + pass + + def run_oracle(port: int = None, open_browser: bool = None): """Main entry point for Oracle server.""" + _force_utf8_console() _init_services() cfg = load_config()