From 5fed6224770e7509b4c15a43451e7298c9eb5880 Mon Sep 17 00:00:00 2001 From: luoxiu065-zjx Date: Fri, 22 May 2026 17:44:43 +0800 Subject: [PATCH] fix(scripts): write meta_data.json with explicit utf-8 encoding On Windows with a non-UTF-8 locale (e.g. CP936/GBK), the default open() encoding crashes json.dump(..., ensure_ascii=False) whenever metadata contains characters outside the locale's range (e.g. Thai U+0E42 in regional service descriptions), breaking `make build`. The matching read at line 77 already pins utf-8; align the write side. Co-Authored-By: Claude Opus 4.7 (1M context) --- scripts/fetch_meta.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/fetch_meta.py b/scripts/fetch_meta.py index b7ab0908f..4e4eea1d4 100644 --- a/scripts/fetch_meta.py +++ b/scripts/fetch_meta.py @@ -89,7 +89,7 @@ def main(): count = len(data.get("services", [])) print(f"fetch-meta: OK, {count} services from remote API", file=sys.stderr) - with open(OUT_PATH, "w") as fp: + with open(OUT_PATH, "w", encoding="utf-8") as fp: json.dump(data, fp, ensure_ascii=False, indent=2) fp.write("\n")