From: Lars Schneider Date: Mon, 21 Sep 2015 08:49:18 +0000 (+0200) Subject: git-p4: use replacement character for non UTF-8 characters in paths X-Git-Tag: v2.7.0-rc0~124^2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/4cb870d8042bef3fdd953c633463eda24ce78f3d git-p4: use replacement character for non UTF-8 characters in paths If non UTF-8 characters are detected in paths then replace them with a placeholder instead of throwing a UnicodeDecodeError exception. This restores the original (implicit) implementation that was broken in 00a9403. Signed-off-by: Lars Schneider Reviewed-by: Luke Diamand Signed-off-by: Junio C Hamano --- diff --git a/git-p4.py b/git-p4.py index 65feb22f58..603045050c 100755 --- a/git-p4.py +++ b/git-p4.py @@ -2219,7 +2219,7 @@ def streamOneP4File(self, file, contents): encoding = 'utf8' if gitConfig('git-p4.pathEncoding'): encoding = gitConfig('git-p4.pathEncoding') - relPath = relPath.decode(encoding).encode('utf8', 'replace') + relPath = relPath.decode(encoding, 'replace').encode('utf8', 'replace') if self.verbose: print 'Path with non-ASCII characters detected. Used %s to encode: %s ' % (encoding, relPath)