Use UTF-8 when opening log and report files

Add encoding="utf-8" to file opens in cli/main.py (log file writes and report markdown writes) to ensure consistent UTF-8 output and avoid encoding errors on systems with different default encodings.
This commit is contained in:
Anand G 2026-03-08 19:28:57 +05:30
parent 7988285330
commit d5d37952c9
1 changed files with 2 additions and 2 deletions

View File

@ -959,7 +959,7 @@ def run_analysis():
func(*args, **kwargs)
timestamp, tool_name, args = obj.tool_calls[-1]
args_str = ", ".join(f"{k}={v}" for k, v in args.items())
with open(log_file, "a") as f:
with open(log_file, "a", encoding="utf-8") as f:
f.write(f"{timestamp} [Tool Call] {tool_name}({args_str})\n")
return wrapper
@ -972,7 +972,7 @@ def run_analysis():
content = obj.report_sections[section_name]
if content:
file_name = f"{section_name}.md"
with open(report_dir / file_name, "w") as f:
with open(report_dir / file_name, "w", encoding="utf-8") as f:
f.write(content)
return wrapper