core: Reconfigure stdout to utf8 (#5017)

This commit is contained in:
Katelyn Gigante
2025-05-22 04:27:03 +10:00
committed by GitHub
parent a076b9257d
commit a409167f64

View File

@@ -540,6 +540,7 @@ def init_logging(name: str, loglevel: typing.Union[str, int] = logging.INFO,
if add_timestamp:
stream_handler.setFormatter(formatter)
root_logger.addHandler(stream_handler)
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
# Relay unhandled exceptions to logger.
if not getattr(sys.excepthook, "_wrapped", False): # skip if already modified