Fix UnicodeEncodeError pe Windows pentru caractere românești
Problema: - Logging eșua cu UnicodeEncodeError când scria caractere românești (ă, î, ș) - Windows cmd.exe folosește cp1252 implicit, nu UTF-8 Soluție: - Forțare encoding UTF-8 pentru stdout și stderr - Folosește io.TextIOWrapper cu encoding='utf-8' - errors='replace' pentru caractere care nu pot fi encodate 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ Telegram Trigger Bot - Declanșează BTGO Scraper prin comandă Telegram
|
||||
|
||||
import os
|
||||
import sys
|
||||
import io
|
||||
import subprocess
|
||||
import logging
|
||||
import json
|
||||
@@ -25,6 +26,10 @@ CHAT_ID = os.getenv('TELEGRAM_CHAT_ID')
|
||||
POLL_TIMEOUT = int(os.getenv('TELEGRAM_POLL_TIMEOUT', 60)) # Default 60 secunde
|
||||
|
||||
# Logging - force stdout instead of stderr (for Windows service logging)
|
||||
# Set UTF-8 encoding for stdout to support Romanian characters
|
||||
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace')
|
||||
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8', errors='replace')
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format='[%(asctime)s] [%(levelname)s] %(message)s',
|
||||
|
||||
Reference in New Issue
Block a user