From 7988285330b853e7b7dec1ae144df31950d0db5e Mon Sep 17 00:00:00 2001 From: Anand G <34826965+anandgsaga@users.noreply.github.com> Date: Sun, 8 Mar 2026 19:17:24 +0530 Subject: [PATCH] Open log file with UTF-8 encoding Specify encoding='utf-8' when opening the log file in append mode to ensure non-ASCII characters are written correctly and to avoid Unicode-related errors when writing log entries. --- cli/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/main.py b/cli/main.py index fb97d189..02a6bbb4 100644 --- a/cli/main.py +++ b/cli/main.py @@ -948,7 +948,7 @@ def run_analysis(): func(*args, **kwargs) timestamp, message_type, content = obj.messages[-1] content = content.replace("\n", " ") # Replace newlines with spaces - with open(log_file, "a") as f: + with open(log_file, "a", encoding="utf-8") as f: f.write(f"{timestamp} [{message_type}] {content}\n") return wrapper