From cb0ba0b447a54f1ae436b32861c88cacd4026548 Mon Sep 17 00:00:00 2001 From: LarFii <834462287@qq.com> Date: Fri, 11 Oct 2024 11:22:17 +0800 Subject: [PATCH] update utils.py --- lightrag/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lightrag/utils.py b/lightrag/utils.py index c75b4270..9496cf34 100644 --- a/lightrag/utils.py +++ b/lightrag/utils.py @@ -94,11 +94,11 @@ def wrap_embedding_func_with_attrs(**kwargs): def load_json(file_name): if not os.path.exists(file_name): return None - with open(file_name) as f: + with open(file_name, encoding="utf-8") as f: return json.load(f) def write_json(json_obj, file_name): - with open(file_name, "w") as f: + with open(file_name, "w", encoding="utf-8") as f: json.dump(json_obj, f, indent=2, ensure_ascii=False) def encode_string_by_tiktoken(content: str, model_name: str = "gpt-4o"):