diff mercurial/util.py @ 3835:d1ce5461beed

Allow the user to specify the fallback encoding for the changelog Example: use EUC-JP instead of ISO-8859-1: [ui] fallbackencoding = EUC-JP
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Fri, 08 Dec 2006 22:01:05 -0200
parents fc5ba0ab7f45
children abaa2cd00d2b
line wrap: on
line diff
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -19,6 +19,7 @@ demandload(globals(), "os threading time
 
 _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 @@ def tolocal(s):
     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")