完善V1.4踢乒乓球版本

This commit is contained in:
myperworld committed 2026-01-20 22:15:03 +08:00
1 parent d14fe6c37b
commit 72455a5e76
1864 files changed
+19294 -218

No files matched your search

@@ -0,0 +1,27 @@
from __future__ import annotations
import os
import sys
def configure_utf8_console() -> None:
"""Ensure stdout/stderr use UTF-8 encoding on Windows consoles.
Safe no-op on non-Windows platforms and on environments where
reconfigure is unavailable.
"""
if os.name != "nt":
return
try:
if hasattr(sys.stdout, "reconfigure") and callable(
getattr(sys.stdout, "reconfigure", None)
):
sys.stdout.reconfigure(encoding="utf-8", errors="replace") # type: ignore[attr-defined]
if hasattr(sys.stderr, "reconfigure") and callable(
getattr(sys.stderr, "reconfigure", None)
):
sys.stderr.reconfigure(encoding="utf-8", errors="replace") # type: ignore[attr-defined]
except (AttributeError, OSError):
# Older Python versions or redirected streams may not support reconfigure
pass