mercurial/posix.py
branchstable
changeset 18501 a3b2dc1aa909
parent 18442 ecba9b0e7672
child 18868 cafa447a7d3b
equal deleted inserted replaced
18500:f0124a65e8f8 18501:a3b2dc1aa909
   193 if sys.platform == 'darwin':
   193 if sys.platform == 'darwin':
   194     import fcntl # only needed on darwin, missing on jython
   194     import fcntl # only needed on darwin, missing on jython
   195 
   195 
   196     def normcase(path):
   196     def normcase(path):
   197         try:
   197         try:
       
   198             path.decode('ascii') # throw exception for non-ASCII character
       
   199             return path.lower()
       
   200         except UnicodeDecodeError:
       
   201             pass
       
   202         try:
   198             u = path.decode('utf-8')
   203             u = path.decode('utf-8')
   199         except UnicodeDecodeError:
   204         except UnicodeDecodeError:
   200             # percent-encode any characters that don't round-trip
   205             # percent-encode any characters that don't round-trip
   201             p2 = path.decode('utf-8', 'ignore').encode('utf-8')
   206             p2 = path.decode('utf-8', 'ignore').encode('utf-8')
   202             s = ""
   207             s = ""