changeset 27380:c7129ed280b8

mac: fix percent-encoding of non-utf-8 characters (issue4999)
author Matt Mackall <mpm@selenic.com>
date Sat, 12 Dec 2015 21:36:21 -0600
parents 2278870bb997
children 988367ac2a2a
files mercurial/posix.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/posix.py	Sun Dec 13 11:19:55 2015 -0800
+++ b/mercurial/posix.py	Sat Dec 12 21:36:21 2015 -0600
@@ -270,13 +270,13 @@
             # OS X percent-encodes any bytes that aren't valid utf-8
             s = ''
             pos = 0
-            l = len(s)
+            l = len(path)
             while pos < l:
                 try:
                     c = encoding.getutf8char(path, pos)
                     pos += len(c)
                 except ValueError:
-                    c = '%%%%02X' % path[pos]
+                    c = '%%%02X' % ord(path[pos])
                     pos += 1
                 s += c