Skip to content

Commit

Permalink
Merge pull request #1404 from pierotofy/encfix
Browse files Browse the repository at this point in the history
Fix console write encoding
  • Loading branch information
pierotofy committed Sep 22, 2023
2 parents 7bb818d + 0093ca7 commit bf3eec2
Showing 1 changed file with 3 additions and 3 deletions.
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)

0 comments on commit bf3eec2

Please sign in to comment.