git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
larsxschneider@gmail.com <larsxschneider@gmail.com>
Date
Sep 21, 2015, 08:49 UTC
Message-ID
<1442825358-90294-2-git-send-email-larsxschneider@gmail.com>
In-Reply-To
<1442825358-90294-1-git-send-email-larsxschneider@gmail.com>
From: Lars Schneider <larsxschneider@gmail.com>

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@gmail.com>
---
 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
Previous: larsxschneider@gmail.comNext: Luke Diamand
Message 2 of 4 in “git-p4: use replacement character for non UTF-8 characters in paths”
  1. git-p4: use replacement character for non UTF-8 characters in pathslarsxschneider@gmail.com, Sep 21, 2015
  2. git-p4: use replacement character for non UTF-8 characters in pathslarsxschneider@gmail.com, Sep 21, 2015
  3. Luke DiamandSep 21, 2015
  4. Junio C HamanoSep 21, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.