[PATCH v3] git-p4: use replacement character for non UTF-8 characters in paths

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Lars Schneider <larsxschneider@xxxxxxxxx>

If non UTF-8 characters are detected in paths then replace them with �
instead of throwing a UnicodeDecodeError exception. This restores the
original (implicit) implementation that was broken in 00a9403.

Signed-off-by: Lars Schneider <larsxschneider@xxxxxxxxx>
---
 git-p4.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-p4.py b/git-p4.py
index e7510a9..215f556 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -2226,7 +2226,7 @@ class P4Sync(Command, P4UserMap):
             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)
 
-- 
2.5.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]