From 1dc90b8ce58616ee9fed1ab9819b605d1275bc1a Mon Sep 17 00:00:00 2001 From: Sara <sarasdj@stud.ntnu.no> Date: Fri, 10 May 2024 19:07:13 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20'=C3=B8'=20character=20encoding=20in=20f?= =?UTF-8?q?iles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/map_handler/add_new_lake.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/server/map_handler/add_new_lake.py b/server/map_handler/add_new_lake.py index 559385a8..46a2a480 100644 --- a/server/map_handler/add_new_lake.py +++ b/server/map_handler/add_new_lake.py @@ -188,16 +188,17 @@ def write_json_to_file(lake_name: str, map_data: dict): json.dump(map_data, f) # Read all_system_lakes.json - with open(LAKE_RELATIONS_PATH + 'all_lake_names.json', 'r') as file: - data = json.load(file) + with open(LAKE_RELATIONS_PATH + 'all_lake_names.json', 'r', encoding='utf-8') as f: + data = json.load(f) # Check if the lake name exists in the list if lake_name not in data: data.append(lake_name) # Only append to list if it does not already exist # Update all_lake_names.json with new lake name - with open(LAKE_RELATIONS_PATH + 'all_lake_names.json', 'w') as file: - json.dump(data, file, ensure_ascii=False, indent=2) + with open(LAKE_RELATIONS_PATH + 'all_lake_names.json', 'w', encoding='utf-8') as f: + json.dump(data, f, ensure_ascii=False, indent=2) + # Plotting the map can take a considerable amount of time, especially when creating maps with many -- GitLab