From dcc2a210d98f8d4942323de4b26a960c5a1038f4 Mon Sep 17 00:00:00 2001 From: aoout Date: Fri, 25 Aug 2023 01:30:20 +0800 Subject: [PATCH] support chinese notes. --- pyomd/note.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyomd/note.py b/pyomd/note.py index be0d37d..c25fd1b 100644 --- a/pyomd/note.py +++ b/pyomd/note.py @@ -30,7 +30,7 @@ def __init__(self, path: Union[Path, str]): """ self.path: Path = Path(path) try: - with open(self.path, "r") as f: + with open(self.path, "r", encoding='utf-8') as f: self.content: str = f.read() except Exception as e: raise NoteCreationError(path=path, exception=e) from e @@ -130,7 +130,7 @@ def write(self, path: Union[Path, None] = None): path to the note. If None, overwrites the current note content. """ p = self.path if path is None else path - with open(p, "w") as f: + with open(p, "w", encoding='utf-8') as f: f.write(self.content) @staticmethod