encoding: normalize some silly encoding names 1.1
authorMatt Mackall <mpm@selenic.com>
Tue, 02 Dec 2008 13:05:40 -0600
changeset 7461 2a67430f92f1
parent 7460 3342e6ada4b9
child 7462 40098e76d376
encoding: normalize some silly encoding names
mercurial/util.py
--- a/mercurial/util.py	Tue Dec 02 19:36:43 2008 +0100
+++ b/mercurial/util.py	Tue Dec 02 13:05:40 2008 -0600
@@ -81,6 +81,8 @@
     popen3 = os.popen3
 
 
+_encodingfixup = {'646': 'ascii', 'ANSI_X3.4-1968': 'ascii'}
+
 try:
     _encoding = os.environ.get("HGENCODING")
     if sys.platform == 'darwin' and not _encoding:
@@ -91,6 +93,7 @@
         _encoding = locale.getlocale()[1]
     if not _encoding:
         _encoding = locale.getpreferredencoding() or 'ascii'
+        _encoding = _encodingfixup.get(_encoding, _encoding)
 except locale.Error:
     _encoding = 'ascii'
 _encodingmode = os.environ.get("HGENCODINGMODE", "strict")