Skip to content

Commit

Permalink
Fix encoding on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
pierotofy committed Sep 22, 2023
1 parent 92b9838 commit 0093ca7
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 0093ca7

Please sign in to comment.