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 <larsxschneider@gmail.com> Reviewed-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Lars Schneider committed
Sep 21, 2015 at 10:49 UTC
4cb870d8042bef3fdd953c633463eda24ce78f3d
1 file changed
+1
-1
git-p4.py
+1
-1
@@ -2219,7 +2219,7 @@ class P4Sync(Command, P4UserMap):
2219
encoding = 'utf8'
2220
if gitConfig('git-p4.pathEncoding'):
2221
encoding = gitConfig('git-p4.pathEncoding')
2222
- relPath = relPath.decode(encoding).encode('utf8', 'replace')
2222
+ relPath = relPath.decode(encoding, 'replace').encode('utf8', 'replace')
2223
if self.verbose:
2224
print 'Path with non-ASCII characters detected. Used %s to encode: %s ' % (encoding, relPath)
2225