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

@@ -246,7 +246,7 @@ class Network(util.DaemonThread):
return []
path = os.path.join(self.config.path, "recent_servers")
try:
with open(path, "r") as f:
with open(path, "r", encoding='utf-8') as f:
data = f.read()
return json.loads(data)
except:
@@ -258,7 +258,7 @@ class Network(util.DaemonThread):
path = os.path.join(self.config.path, "recent_servers")
s = json.dumps(self.recent_servers, indent=4, sort_keys=True)
try:
with open(path, "w") as f:
with open(path, "w", encoding='utf-8') as f:
f.write(s)
except:
pass
@@ -1089,7 +1089,7 @@ class Network(util.DaemonThread):
def export_checkpoints(self, path):
# run manually from the console to generate checkpoints
cp = self.blockchain().get_checkpoints()
with open(path, 'w') as f:
with open(path, 'w', encoding='utf-8') as f:
f.write(json.dumps(cp, indent=4))
def max_checkpoint(self):