fix: use UTF-8 for text file operations

This commit is contained in:
Haoran
2026-08-24 20:28:37 +08:00
parent a32a73f700
commit 199402f9d4
59 changed files with 435 additions and 289 deletions

View File

@@ -78,8 +78,8 @@ class MessageBus:
def read_inbox(self, name):
path = self.dir / f"{name}.jsonl"
if not path.exists(): return "[]"
msgs = [json.loads(l) for l in path.read_text().strip().splitlines() if l]
path.write_text("") # drain
msgs = [json.loads(l) for l in path.read_text(encoding="utf-8").strip().splitlines() if l]
path.write_text("", encoding="utf-8") # drain
return json.dumps(msgs, indent=2)
```