Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tools/skills_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the paired read_text() calls too (_read_cache at current main line 1045 and _read_index_cache at line 3234). Writing UTF-8 while reading through the Windows default locale does not preserve the non-ASCII metadata this change is intended to protect.

except OSError as e:
logger.debug("Could not write cache: %s", e)

Expand Down Expand Up @@ -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)

Expand Down
Loading