1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-21 16:16:20 +02:00

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>
This commit is contained in:
Lars Schneider 2015-09-21 10:49:18 +02:00 committed by Junio C Hamano
parent 00a9403a10
commit 4cb870d804

View File

@ -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)