Skip to content

Commit 375a635

Browse files
committed
Try with bytes
1 parent 13c84b6 commit 375a635

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pygit2/utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ def maybe_string(ptr):
3434
if not ptr:
3535
return None
3636

37-
return os.fsdecode(ffi.string(ptr))
37+
try:
38+
return ffi.string(ptr).decode("utf8")
39+
except UnicodeDecodeError:
40+
return ffi.string(ptr)
3841

3942

4043
def to_bytes(s, encoding='utf-8', errors='strict'):

0 commit comments

Comments
 (0)