encoding: protect against non-ascii default encoding stable
authorCesar Mena <cesarmena@gmail.com>
Sun, 22 Apr 2012 21:27:52 -0400
branchstable
changeset 16493 72c6240a4b7d
parent 16492 774e2dcd0a65
child 16494 e1f0305eabe4
encoding: protect against non-ascii default encoding If the default python encoding was changed from ascii, the attempt to encode as ascii before lower() could throw a UnicodeEncodeError. Catch UnicodeError instead to prevent an unhandled exception.
mercurial/encoding.py
--- a/mercurial/encoding.py	Mon Apr 23 14:32:59 2012 +0200
+++ b/mercurial/encoding.py	Sun Apr 22 21:27:52 2012 -0400
@@ -169,7 +169,7 @@
     "best-effort encoding-aware case-folding of local string s"
     try:
         return s.encode('ascii').lower()
-    except UnicodeDecodeError:
+    except UnicodeError:
         pass
     try:
         if isinstance(s, localstr):