Skip to content

Commit 3d7eaf1

Browse files
ishepardByron
authored andcommitted
fix decoding problem
1 parent a2d8a51 commit 3d7eaf1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

git/objects/commit.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,8 @@ def _deserialize(self, stream):
484484
buf = enc.strip()
485485
while buf:
486486
if buf[0:10] == b"encoding ":
487-
self.encoding = buf[buf.find(' ') + 1:].decode('ascii')
487+
self.encoding = buf[buf.find(' ') + 1:].decode(
488+
self.encoding, 'ignore')
488489
elif buf[0:7] == b"gpgsig ":
489490
sig = buf[buf.find(b' ') + 1:] + b"\n"
490491
is_next_header = False
@@ -498,7 +499,7 @@ def _deserialize(self, stream):
498499
break
499500
sig += sigbuf[1:]
500501
# end read all signature
501-
self.gpgsig = sig.rstrip(b"\n").decode('ascii')
502+
self.gpgsig = sig.rstrip(b"\n").decode(self.encoding, 'ignore')
502503
if is_next_header:
503504
continue
504505
buf = readline().strip()

0 commit comments

Comments
 (0)