From db3128f2ec8feedd16f0379aedd39287f4186c54 Mon Sep 17 00:00:00 2001 From: Gaurav Pathak Date: Tue, 26 Jan 2021 18:10:43 +0530 Subject: [PATCH] git_command.py: Handle unicode decode error repo diffmanifests saves git commit messages in buf and uses default utf-8 decoding, in some scenarios git commit message can itself contain a non UTF-8 character due to a typo or incorrect i18n.commitEncoding. e.g. d354d9afe923 [PATCH] fbcon: don\xb4t call set_par() in fbcon_init() if vc_mode == KD_GRAPHICS Convert the buf containing git commits to string if decoding to utf-8 encounters an error. Signed-off-by: Gaurav Pathak Change-Id: If818562f0faaa5062c765fbea11dc0e1c86a24d7 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/294742 Reviewed-by: Mike Frysinger --- git_command.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git_command.py b/git_command.py index b29d240e..2b3975ec 100644 --- a/git_command.py +++ b/git_command.py @@ -395,7 +395,7 @@ class GitCommand(object): s_in.remove(s) continue if not hasattr(buf, 'encode'): - buf = buf.decode() + buf = buf.decode('utf-8', 'backslashreplace') if s.std_name == 'stdout': self.stdout += buf else: