Import proper UTF-8.

What's the point of Python defaulting to ASCII
when JSON is explicitly defined as a binary
format with a default character encoding of
UTF-8? 🙄
This commit is contained in:
D. Berge
2020-09-29 17:45:45 +02:00
parent 2733223037
commit 65c26f56c7

View File

@@ -25,8 +25,8 @@ def write_file (filename, payload):
print("Writing to", filename)
tmpname = filename.parent / (filename.name + ".tmp")
filename.parent.mkdir(parents=True, exist_ok=True)
with open(tmpname, "w") as fd:
json.dump(payload, fd, indent=4)
with open(tmpname, "w", encoding="utf8") as fd:
json.dump(payload, fd, indent=4, ensure_ascii=False)
os.rename(tmpname, filename)
def seis_data (survey):