Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the encoding to 'utf-8' globally #432

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
from src.http.http_server import http_server
import traceback
from src.http.routes.routeable import routeable
Expand All @@ -7,6 +8,18 @@
import src.setup as setup
from src.ui.start_ui import StartUI

# Ensure sys.stdout and sys.stderr use UTF-8 encoding
if hasattr(sys.stdout, "reconfigure"):
sys.stdout.reconfigure(encoding='utf-8')
sys.stderr.reconfigure(encoding='utf-8')

# Configure logging to use the updated streams
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s %(levelname)s: %(message)s",
handlers=[logging.StreamHandler(sys.stdout)]
)

def main():
try:
config, language_info = setup.initialise(
Expand Down