From 5bd8b7d51fabf619e722be0a3b0831812c26c957 Mon Sep 17 00:00:00 2001 From: zhujie2006 Date: Sat, 20 Dec 2025 12:40:31 +0800 Subject: [PATCH] [fix] set encoding to utf-8 in samples' tool.py while open sample data json file --- samples/agent/adk/contact_lookup/tools.py | 2 +- samples/agent/adk/restaurant_finder/tools.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/agent/adk/contact_lookup/tools.py b/samples/agent/adk/contact_lookup/tools.py index 56c9e15e..77630a0b 100644 --- a/samples/agent/adk/contact_lookup/tools.py +++ b/samples/agent/adk/contact_lookup/tools.py @@ -34,7 +34,7 @@ def get_contact_info(name: str, tool_context: ToolContext, department: str = "") try: script_dir = os.path.dirname(__file__) file_path = os.path.join(script_dir, "contact_data.json") - with open(file_path) as f: + with open(file_path, encoding="utf-8") as f: contact_data_str = f.read() if base_url := tool_context.state.get("base_url"): contact_data_str = contact_data_str.replace("http://localhost:10002", base_url) diff --git a/samples/agent/adk/restaurant_finder/tools.py b/samples/agent/adk/restaurant_finder/tools.py index 6a6dd453..7dc081fa 100644 --- a/samples/agent/adk/restaurant_finder/tools.py +++ b/samples/agent/adk/restaurant_finder/tools.py @@ -34,7 +34,7 @@ def get_restaurants(cuisine: str, location: str, tool_context: ToolContext, cou try: script_dir = os.path.dirname(__file__) file_path = os.path.join(script_dir, "restaurant_data.json") - with open(file_path) as f: + with open(file_path, encoding="utf-8") as f: restaurant_data_str = f.read() if base_url := tool_context.state.get("base_url"): restaurant_data_str = restaurant_data_str.replace("http://localhost:10002", base_url)