##// END OF EJS Templates
Respect locale environment variables on darwin....
Brendan Cully -
r4540:133a52d7 default
parent child Browse files
Show More
@@ -17,8 +17,15 b' import cStringIO, errno, getpass, popen2'
17 17 import os, threading, time, calendar, ConfigParser, locale, glob
18 18
19 19 try:
20 _encoding = os.environ.get("HGENCODING") or locale.getpreferredencoding() \
21 or "ascii"
20 _encoding = os.environ.get("HGENCODING")
21 if sys.platform == 'darwin' and not _encoding:
22 # On darwin, getpreferredencoding ignores the locale environment and
23 # always returns mac-roman. We override this if the environment is
24 # not C (has been customized by the user).
25 locale.setlocale(locale.LC_CTYPE, '')
26 _encoding = locale.getlocale()[1]
27 if not _encoding:
28 _encoding = locale.getpreferredencoding() or 'ascii'
22 29 except locale.Error:
23 30 _encoding = 'ascii'
24 31 _encodingmode = os.environ.get("HGENCODINGMODE", "strict")
General Comments 0
You need to be logged in to leave comments. Login now