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.
--- 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):