mercurial/encoding.py
changeset 9574 9e9f63d5c456
parent 8312 b87a50b7125c
child 10263 25e572394f5c
--- a/mercurial/encoding.py	Thu Oct 08 23:42:33 2009 +0200
+++ b/mercurial/encoding.py	Sat Oct 10 12:00:43 2009 +0200
@@ -16,7 +16,9 @@
         # On darwin, getpreferredencoding ignores the locale environment and
         # always returns mac-roman. We override this if the environment is
         # not C (has been customized by the user).
-        locale.setlocale(locale.LC_CTYPE, '')
+        lc = locale.setlocale(locale.LC_CTYPE, '')
+        if lc == 'UTF-8':
+            locale.setlocale(locale.LC_CTYPE, 'en_US.UTF-8')
         encoding = locale.getlocale()[1]
     if not encoding:
         encoding = locale.getpreferredencoding() or 'ascii'