From d244a1c1a7de8a450b07f88ba7483b93a7f786ab Mon Sep 17 00:00:00 2001 From: myhloli Date: Thu, 25 Jul 2024 02:41:22 +0800 Subject: [PATCH] fix(config_reader): add utf-8 encoding when reading config file Specify utf-8 encoding when opening the configuration file to ensure compatibility with files containing non-ASCII characters, avoiding potentialencoding errors. --- magic_pdf/libs/config_reader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/magic_pdf/libs/config_reader.py b/magic_pdf/libs/config_reader.py index 0978ac64..7454c577 100644 --- a/magic_pdf/libs/config_reader.py +++ b/magic_pdf/libs/config_reader.py @@ -22,7 +22,7 @@ def read_config(): if not os.path.exists(config_file): raise FileNotFoundError(f"{config_file} not found") - with open(config_file, "r") as f: + with open(config_file, "r", encoding="utf-8") as f: config = json.load(f) return config