Skip to content

100+ AI Agents, Agent Skills and RAG Apps - Free and Open Source.

fix(agent_skills): decode git subprocess output as UTF-8 (Windows cp1252 crash)

Pcecil210c499421ea48
diff --git a/agent_skills/commit-archaeologist/scripts/archaeologist.py b/agent_skills/commit-archaeologist/scripts/archaeologist.py
index 79eb9506..c96904b7 100644
--- a/agent_skills/commit-archaeologist/scripts/archaeologist.py
+++ b/agent_skills/commit-archaeologist/scripts/archaeologist.py
@@ -37,6 +37,12 @@ def git(repo, args, required=True):
["git", "-C", repo, *args],
capture_output=True,
text=True,
+ # Decode git output as UTF-8. With text=True and no encoding, Python
+ # uses the locale default (cp1252 on Windows), which raises
+ # UnicodeDecodeError on non-Latin-1 bytes in commit messages or file
+ # content (emoji, em-dashes, …).
+ encoding="utf-8",
+ errors="replace",
timeout=30,
)
except FileNotFoundError as exc:
diff --git a/agent_skills/scope-creep-detector/scripts/scope_creep.py b/agent_skills/scope-creep-detector/scripts/scope_creep.py
index 34c022a4..cd8b470e 100644
--- a/agent_skills/scope-creep-detector/scripts/scope_creep.py
+++ b/agent_skills/scope-creep-detector/scripts/scope_creep.py
@@ -428,6 +428,11 @@ def run_git(repo, args):
["git", "-C", repo, *args],
capture_output=True,
text=True,
+ # Decode git output as UTF-8. With text=True and no encoding, Python uses
+ # the locale default (cp1252 on Windows), which raises UnicodeDecodeError
+ # on non-Latin-1 bytes in diffs or commit messages (emoji, em-dashes, …).
+ encoding="utf-8",
+ errors="replace",
timeout=30,
)
if result.returncode != 0: