Skip to content

Commit

Permalink
fix: 未指定utf-8保存已输出的公告
Browse files Browse the repository at this point in the history
  • Loading branch information
RockChinQ committed Apr 2, 2023
1 parent f079d7b commit 9617be0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/utils/announcement.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ def read_saved() -> str:
# 已保存的在res/announcement_saved
# 检查是否存在
if not os.path.exists("res/announcement_saved"):
with open("res/announcement_saved", "w") as f:
with open("res/announcement_saved", "w", encoding="utf-8") as f:
f.write("")

with open("res/announcement_saved", "r") as f:
with open("res/announcement_saved", "r", encoding="utf-8") as f:
content = f.read()

return content


def write_saved(content: str):
# 已保存的在res/announcement_saved
with open("res/announcement_saved", "w") as f:
with open("res/announcement_saved", "w", encoding="utf-8") as f:
f.write(content)


Expand Down

0 comments on commit 9617be0

Please sign in to comment.