mercurial/posix.py
changeset 27380 c7129ed280b8
parent 27362 c220434a3461
child 29530 3239e2fdd2e2
equal deleted inserted replaced
27379:2278870bb997 27380:c7129ed280b8
   268             u = path.decode('utf-8')
   268             u = path.decode('utf-8')
   269         except UnicodeDecodeError:
   269         except UnicodeDecodeError:
   270             # OS X percent-encodes any bytes that aren't valid utf-8
   270             # OS X percent-encodes any bytes that aren't valid utf-8
   271             s = ''
   271             s = ''
   272             pos = 0
   272             pos = 0
   273             l = len(s)
   273             l = len(path)
   274             while pos < l:
   274             while pos < l:
   275                 try:
   275                 try:
   276                     c = encoding.getutf8char(path, pos)
   276                     c = encoding.getutf8char(path, pos)
   277                     pos += len(c)
   277                     pos += len(c)
   278                 except ValueError:
   278                 except ValueError:
   279                     c = '%%%%02X' % path[pos]
   279                     c = '%%%02X' % ord(path[pos])
   280                     pos += 1
   280                     pos += 1
   281                 s += c
   281                 s += c
   282 
   282 
   283             u = s.decode('utf-8')
   283             u = s.decode('utf-8')
   284 
   284