mercurial/encoding.py
branchstable
changeset 17236 9fb8312dbdbd
parent 17235 3745ae495ce5
child 17424 e7cfe3587ea4
equal deleted inserted replaced
17235:3745ae495ce5 17236:9fb8312dbdbd
   188         raise error.Abort(k, hint="please check your locale settings")
   188         raise error.Abort(k, hint="please check your locale settings")
   189 
   189 
   190 def upper(s):
   190 def upper(s):
   191     "best-effort encoding-aware case-folding of local string s"
   191     "best-effort encoding-aware case-folding of local string s"
   192     try:
   192     try:
       
   193         s.decode('ascii') # throw exception for non-ASCII character
       
   194         return s.upper()
       
   195     except UnicodeDecodeError:
       
   196         pass
       
   197     try:
   193         if isinstance(s, localstr):
   198         if isinstance(s, localstr):
   194             u = s._utf8.decode("utf-8")
   199             u = s._utf8.decode("utf-8")
   195         else:
   200         else:
   196             u = s.decode(encoding, encodingmode)
   201             u = s.decode(encoding, encodingmode)
   197 
   202