Skip to content

Commit 8c013fa

Browse files
committed
fix: use utf-8 encoding for subprocess to handle non-ascii chars
1 parent 2fa475e commit 8c013fa

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

git_py_stats/git_operations.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ def run_git_command(cmd: List[str]) -> Optional[str]:
2121
return None
2222
try:
2323
result = subprocess.run(
24-
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, check=True
24+
cmd,
25+
stdout=subprocess.PIPE,
26+
stderr=subprocess.PIPE,
27+
text=True,
28+
check=True,
29+
encoding="utf-8",
30+
errors="replace",
2531
)
2632
return result.stdout.strip()
2733
except subprocess.CalledProcessError as e:

0 commit comments

Comments
 (0)