--- a/mercurial/util.py Fri Dec 08 23:33:32 2006 +0100
+++ b/mercurial/util.py Fri Dec 08 22:01:05 2006 -0200
@@ -19,6 +19,7 @@
_encoding = os.environ.get("HGENCODING") or locale.getpreferredencoding()
_encodingmode = os.environ.get("HGENCODINGMODE", "strict")
+_fallbackencoding = 'ISO-8859-1'
def tolocal(s):
"""
@@ -30,7 +31,7 @@
using UTF-8, then Latin-1, and failing that, we use UTF-8 and
replace unknown characters.
"""
- for e in "utf-8 latin1".split():
+ for e in ('UTF-8', _fallbackencoding):
try:
u = s.decode(e) # attempt strict decoding
return u.encode(_encoding, "replace")