diff --git a/mercurial/encoding.py b/mercurial/encoding.py --- a/mercurial/encoding.py +++ b/mercurial/encoding.py @@ -190,6 +190,11 @@ def lower(s): def upper(s): "best-effort encoding-aware case-folding of local string s" try: + s.decode('ascii') # throw exception for non-ASCII character + return s.upper() + except UnicodeDecodeError: + pass + try: if isinstance(s, localstr): u = s._utf8.decode("utf-8") else: