From d43135ca45f42fafe312ce7f4a73ff4a6a65f7af Mon Sep 17 00:00:00 2001 From: "Mr. Guo" <474224024@qq.com> Date: Mon, 23 Sep 2024 15:01:35 +0800 Subject: [PATCH] Fix encoding issue when loading i18n json file (#1341) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: João Moura --- src/crewai/utilities/i18n.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crewai/utilities/i18n.py b/src/crewai/utilities/i18n.py index b283f57c0..e325834f3 100644 --- a/src/crewai/utilities/i18n.py +++ b/src/crewai/utilities/i18n.py @@ -17,13 +17,13 @@ class I18N(BaseModel): """Load prompts from a JSON file.""" try: if self.prompt_file: - with open(self.prompt_file, "r") as f: + with open(self.prompt_file, "r", encoding="utf-8") as f: self._prompts = json.load(f) else: dir_path = os.path.dirname(os.path.realpath(__file__)) prompts_path = os.path.join(dir_path, "../translations/en.json") - with open(prompts_path, "r") as f: + with open(prompts_path, "r", encoding="utf-8") as f: self._prompts = json.load(f) except FileNotFoundError: raise Exception(f"Prompt file '{self.prompt_file}' not found.")