changeset 16493:72c6240a4b7d stable

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.
author Cesar Mena <cesarmena@gmail.com>
date Sun, 22 Apr 2012 21:27:52 -0400
parents 774e2dcd0a65
children e1f0305eabe4
files mercurial/encoding.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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):