Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix console write encoding #1404

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/classes/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def __str__(self):
return ""

try:
with open(self.file, 'r') as f:
with open(self.file, 'r', encoding="utf-8") as f:
return f.read()
except IOError:
logger.warn("Cannot read console file: %s" % self.file)
Expand All @@ -36,7 +36,7 @@ def append(self, text):
if not os.path.isdir(self.base_dir):
os.makedirs(self.base_dir, exist_ok=True)

with open(self.file, "a") as f:
with open(self.file, "a", encoding="utf-8") as f:
f.write(text)
except IOError:
logger.warn("Cannot append to console file: %s" % self.file)
Expand All @@ -47,7 +47,7 @@ def reset(self, text = ""):
if not os.path.isdir(self.base_dir):
os.makedirs(self.base_dir, exist_ok=True)

with open(self.file, "w") as f:
with open(self.file, "w", encoding="utf-8") as f:
f.write(text)
except IOError:
logger.warn("Cannot reset console file: %s" % self.file)