From 7a60e408fe786fdbee20aeb3b729cb8ca89b1255 Mon Sep 17 00:00:00 2001 From: AlexFucuson9 Date: Sat, 11 Jul 2026 20:29:30 +0700 Subject: [PATCH] fix: add encoding="utf-8" to write_text calls with ensure_ascii=False in skills_hub MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Path.write_text() without encoding= defaults to the platform encoding (cp1252 on Windows). When combined with ensure_ascii=False, non-ASCII characters in skill names, descriptions, and metadata are silently corrupted on Windows — mojibake in cache files that then fail to parse. Affected sites: - _write_index_cache(): cache_file.write_text(json.dumps(data, ensure_ascii=False)) - _search_catalog_fallback(): same pattern with default=str All other write_text() calls in the codebase already pass encoding="utf-8". --- tools/skills_hub.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/skills_hub.py b/tools/skills_hub.py index 9883b720ee025..3f0e562633f1f 100644 --- a/tools/skills_hub.py +++ b/tools/skills_hub.py @@ -1052,7 +1052,7 @@ def _write_cache(self, key: str, data: list) -> None: index_cache_dir.mkdir(parents=True, exist_ok=True) cache_file = index_cache_dir / f"{key}.json" try: - cache_file.write_text(json.dumps(data, ensure_ascii=False)) + cache_file.write_text(json.dumps(data, ensure_ascii=False), encoding="utf-8") except OSError as e: logger.debug("Could not write cache: %s", e) @@ -3251,7 +3251,7 @@ def _write_index_cache(key: str, data: Any) -> None: pass cache_file = index_cache_dir / f"{key}.json" try: - cache_file.write_text(json.dumps(data, ensure_ascii=False, default=str)) + cache_file.write_text(json.dumps(data, ensure_ascii=False, default=str), encoding="utf-8") except OSError as e: logger.debug("Could not write cache: %s", e)