equal
deleted
inserted
replaced
14 encoding = os.environ.get("HGENCODING") |
14 encoding = os.environ.get("HGENCODING") |
15 if sys.platform == 'darwin' and not encoding: |
15 if sys.platform == 'darwin' and not encoding: |
16 # On darwin, getpreferredencoding ignores the locale environment and |
16 # On darwin, getpreferredencoding ignores the locale environment and |
17 # always returns mac-roman. We override this if the environment is |
17 # always returns mac-roman. We override this if the environment is |
18 # not C (has been customized by the user). |
18 # not C (has been customized by the user). |
19 locale.setlocale(locale.LC_CTYPE, '') |
19 lc = locale.setlocale(locale.LC_CTYPE, '') |
|
20 if lc == 'UTF-8': |
|
21 locale.setlocale(locale.LC_CTYPE, 'en_US.UTF-8') |
20 encoding = locale.getlocale()[1] |
22 encoding = locale.getlocale()[1] |
21 if not encoding: |
23 if not encoding: |
22 encoding = locale.getpreferredencoding() or 'ascii' |
24 encoding = locale.getpreferredencoding() or 'ascii' |
23 encoding = _encodingfixup.get(encoding, encoding) |
25 encoding = _encodingfixup.get(encoding, encoding) |
24 except locale.Error: |
26 except locale.Error: |