Skip to content

Commit

Permalink
Try os.fsdecode
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavid committed Nov 29, 2024
1 parent dbfa83a commit 13c84b6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pygit2/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def check_error(err, io=False):
# Error message
giterr = C.git_error_last()
if giterr != ffi.NULL:
message = ffi.string(giterr.message).decode('utf8',errors='surrogateescape')
message = ffi.string(giterr.message).decode('utf8', errors='surrogateescape')
else:
message = f'err {err} (no message provided)'

Expand Down
2 changes: 1 addition & 1 deletion pygit2/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def maybe_string(ptr):
if not ptr:
return None

return ffi.string(ptr).decode('utf8', errors='replace')
return os.fsdecode(ffi.string(ptr))


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

0 comments on commit 13c84b6

Please sign in to comment.