Potentially fix locale issues (#284)

This commit is contained in:
Nik
2022-12-16 15:23:04 +01:00
committed by GitHub
parent 346f80beb3
commit 0474095a40
5 changed files with 18 additions and 18 deletions
+4 -4
View File
@@ -35,22 +35,22 @@ class SettingsManager:
self.settings = {}
try:
open(self.path, "x")
open(self.path, "x", encoding="utf-8")
except FileExistsError as e:
self.read()
pass
def read(self):
try:
with open(self.path, "r") as file:
with open(self.path, "r", encoding="utf-8") as file:
self.settings = load(file)
except Exception as e:
print(e)
pass
def commit(self):
with open(self.path, "w+") as file:
dump(self.settings, file, indent=4)
with open(self.path, "w+", encoding="utf-8") as file:
dump(self.settings, file, indent=4, ensure_ascii=False)
def getSetting(self, key, default):
return self.settings.get(key, default)