##// END OF EJS Templates
posix: fix HFS+ percent-encoding folding...
Matt Mackall -
r15563:b61fa748 stable
parent child Browse files
Show More
@@ -176,13 +176,15 b" if sys.platform == 'darwin':"
176 u = path.decode('utf-8')
176 u = path.decode('utf-8')
177 except UnicodeDecodeError:
177 except UnicodeDecodeError:
178 # percent-encode any characters that don't round-trip
178 # percent-encode any characters that don't round-trip
179 p2 = path.decode('utf-8', 'replace').encode('utf-8')
179 p2 = path.decode('utf-8', 'ignore').encode('utf-8')
180 s = ""
180 s = ""
181 for a, b in zip(path, p2):
181 pos = 0
182 if a != b:
182 for c in path:
183 s += "%%%02X" % ord(a)
183 if p2[pos:pos + 1] == c:
184 s += c
185 pos += 1
184 else:
186 else:
185 s += a
187 s += "%%%02X" % ord(c)
186 u = s.decode('utf-8')
188 u = s.decode('utf-8')
187
189
188 # Decompose then lowercase (HFS+ technote specifies lower)
190 # Decompose then lowercase (HFS+ technote specifies lower)
General Comments 0
You need to be logged in to leave comments. Login now