# HG changeset patch # User Cesar Mena # Date 1335144472 14400 # Node ID 72c6240a4b7d294f663007f6dcc5b61c7758f533 # Parent 774e2dcd0a65129f23260c0eae4a855b6bb7ed12 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. diff -r 774e2dcd0a65 -r 72c6240a4b7d 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):