use explicit utf-8 encoding when opening files in text mode
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user