1
0

use explicit utf-8 encoding when opening files in text mode

This commit is contained in:
SomberNight
2018-03-23 21:47:51 +01:00
parent 382f69edd9
commit 9b7536e75c
11 changed files with 25 additions and 25 deletions

View File

@@ -77,7 +77,7 @@ class WalletStorage(PrintError):
self.modified = False
self.pubkey = None
if self.file_exists():
with open(self.path, "r") as f:
with open(self.path, "r", encoding='utf-8') as f:
self.raw = f.read()
self._encryption_version = self._init_encryption_version()
if not self.is_encrypted():
@@ -257,7 +257,7 @@ class WalletStorage(PrintError):
s = s.decode('utf8')
temp_path = "%s.tmp.%s" % (self.path, os.getpid())
with open(temp_path, "w") as f:
with open(temp_path, "w", encoding='utf-8') as f:
f.write(s)
f.flush()
os.fsync(f.fileno())