From 504616eda755993277031ea64e395a940bc625b6 Mon Sep 17 00:00:00 2001 From: Shiva Nadi Date: Mon, 14 Apr 2025 14:45:50 +0200 Subject: [PATCH] dump json with ensure_ascii=False --- dataQuest/preprocessor/parser.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dataQuest/preprocessor/parser.py b/dataQuest/preprocessor/parser.py index efb7dd3..8035407 100644 --- a/dataQuest/preprocessor/parser.py +++ b/dataQuest/preprocessor/parser.py @@ -111,8 +111,9 @@ def save_as_json_compressed(data: Dict[str, Union[Dict[str, str], Dict[int, Dict output_file (str): Path to the output JSON file. """ try: - with gzip.open(output_file, 'wt') as json_file: - json.dump(data, json_file, indent=4) + with gzip.open(output_file, 'wt', encoding='utf-8') as json_file: + json.dump(data, json_file, indent=4, ensure_ascii=False) + except Exception as e: logging.error(f"Error saving compressed JSON to {output_file}: {e}") # noqa: E501