# sitecustomize.py - Set default encoding to UTF-8 for all Python scripts # Place this file in Python's site-packages directory to fix Windows emoji issues import sys import io # Force UTF-8 encoding for stdout and stderr if sys.stdout.encoding != 'utf-8': sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace') if sys.stderr.encoding != 'utf-8': sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8', errors='replace') # Set default file encoding to UTF-8 import locale locale.setlocale(locale.LC_ALL, '') print("✅ UTF-8 encoding configured automatically", file=sys.stderr)