Fix: Ensure UTF-8 encoding for all file operations

This commit is contained in:
chtangwin
2026-02-10 17:31:45 +08:00
parent 8de36d398f
commit c7b5dd9350
5 changed files with 13 additions and 11 deletions

View File

@@ -66,7 +66,7 @@ class CronService:
if self.store_path.exists():
try:
data = json.loads(self.store_path.read_text())
data = json.loads(self.store_path.read_text(encoding="utf-8"))
jobs = []
for j in data.get("jobs", []):
jobs.append(CronJob(
@@ -148,7 +148,7 @@ class CronService:
]
}
self.store_path.write_text(json.dumps(data, indent=2))
self.store_path.write_text(json.dumps(data, indent=2, ensure_ascii=False), encoding="utf-8")
async def start(self) -> None:
"""Start the cron service."""