changeset 7461:2a67430f92f1 1.1

encoding: normalize some silly encoding names
author Matt Mackall <mpm@selenic.com>
date Tue, 02 Dec 2008 13:05:40 -0600
parents 3342e6ada4b9
children 40098e76d376
files mercurial/util.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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")