[meld/Python3] vc.git: Fix unescaping of unicode filenames from git



commit 6e2bf7eca51398be3d2fbda0f3b42f52bb411345
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Jul 24 11:24:07 2016 +1000

    vc.git: Fix unescaping of unicode filenames from git

 meld/vc/git.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/meld/vc/git.py b/meld/vc/git.py
index bc06ddf..1135fb2 100644
--- a/meld/vc/git.py
+++ b/meld/vc/git.py
@@ -25,6 +25,7 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+import codecs
 import errno
 import io
 import os
@@ -299,8 +300,8 @@ class Vc(_vc.Vc):
             # Unicode file names and file names containing quotes are
             # returned by git as quoted strings
             if name[0] == '"':
-                name = name.encode('utf-8')
-                name = name[1:-1].decode('unicode_escape')
+                name = name.encode('latin1')
+                name = codecs.escape_decode(name[1:-1])[0].decode('utf-8')
             return os.path.abspath(
                 os.path.join(self.location, name))
 


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