Skip to content

Commit

Permalink
git-p4: use replacement character for non UTF-8 characters in paths
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lars Schneider authored and Junio C Hamano committed Sep 21, 2015
1 parent 00a9403 commit 4cb870d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion git-p4.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 4cb870d

Please sign in to comment.