From 9027877000bc113e144c3450846a5141c2802c54 Mon Sep 17 00:00:00 2001 From: Poiuy7312 Date: Fri, 3 Nov 2023 08:58:27 -0400 Subject: [PATCH] fix: made utf-8 encoding for write_text --- chasten/filesystem.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chasten/filesystem.py b/chasten/filesystem.py index 3755ecc7..1af06532 100644 --- a/chasten/filesystem.py +++ b/chasten/filesystem.py @@ -229,7 +229,7 @@ def write_dict_results( # using indentation to ensure that JSON file is readable results_path_with_file = results_path / complete_results_file_name # use the built-in method from pathlib Path to write the JSON contents - results_path_with_file.write_text(results_json) + results_path_with_file.write_text(results_json, "utf-8") # return the name of the file that contains the JSON dictionary contents return complete_results_file_name @@ -293,7 +293,7 @@ def get_json_results(json_paths: List[Path]) -> List[Dict[Any, Any]]: # iterate through each of the provided paths to a JSON file for json_path in json_paths: # turn the contents of the current JSON file into a dictionary - json_dict = json.loads(json_path.read_text()) + json_dict = json.loads(json_path.read_text("utf-8")) # add the current dictionary to the list of dictionaries json_dicts_list.append(json_dict) # return the list of JSON dictionaries