fix: resolve UnicodeEncodeError on Windows during model evaluation (#389)
Some checks failed
CI / Check and build (Python 3.13) (push) Has been cancelled
CI / Check and build (Python 3.10) (push) Has been cancelled
CI / Check and build (Python 3.11) (push) Has been cancelled
CI / Check and build (Python 3.12) (push) Has been cancelled

* 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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,6 +5,14 @@
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