fix: resolve UnicodeEncodeError on Windows during model evaluation (#389)

* fix: ensure utf-8 encoding for standard output and error to prevent UnicodeEncodeError on Windows

* fix: address bot review feedback

* refactor: deduplicate stream reconfiguration loop
This commit is contained in:
UmranPros
2026-06-18 18:16:43 +05:30
committed by GitHub
parent 00185db9fc
commit 3f68a0d4e5

View File

@@ -5,6 +5,14 @@
import sys import sys
# Ensure standard output/error use UTF-8 instead of system default charmap (e.g. cp1252 on Windows).
for stream in (sys.stdout, sys.stderr):
if (
hasattr(stream, "reconfigure")
and (getattr(stream, "encoding", "") or "").lower() != "utf-8"
):
stream.reconfigure(encoding="utf-8") # type: ignore
from .config import Settings from .config import Settings