Skip to content

Commit

Permalink
Try with bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavid committed Nov 29, 2024
1 parent 13c84b6 commit 375a635
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pygit2/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ def maybe_string(ptr):
if not ptr:
return None

return os.fsdecode(ffi.string(ptr))
try:
return ffi.string(ptr).decode("utf8")
except UnicodeDecodeError:
return ffi.string(ptr)


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

0 comments on commit 375a635

Please sign in to comment.