fix: write briefing files as utf-8

This commit is contained in:
ziperlee
2026-04-09 23:01:17 +08:00
parent f926d6507a
commit 2020156591
2 changed files with 24 additions and 2 deletions
+2 -2
View File
@@ -216,7 +216,7 @@ def show_briefing(date: str = None) -> dict:
if not path.exists():
return {"status": "not_found", "message": f"No briefing found for {date}."}
with open(path) as f:
with open(path, encoding="utf-8") as f:
return json.load(f)
@@ -225,7 +225,7 @@ def _save_briefing(data: dict, suffix: str = ""):
BRIEFS_DIR.mkdir(parents=True, exist_ok=True)
date = datetime.now().strftime("%Y-%m-%d")
path = BRIEFS_DIR / f"{date}{suffix}.json"
with open(path, "w") as f:
with open(path, "w", encoding="utf-8") as f:
json.dump(data, f, indent=2, default=str)