# HG changeset patch # User Dirkjan Ochtman # Date 2009-10-10 10:00:43 # Node ID 9e9f63d5c456ad6522807cd00bb3daa548daa4b0 # Parent b8352a3617f3a5040decd14f15db57e2462bc204 encoding: fix issue with non-standard UTF-8 CTYPE on OS X diff --git a/mercurial/encoding.py b/mercurial/encoding.py --- a/mercurial/encoding.py +++ b/mercurial/encoding.py @@ -16,7 +16,9 @@ try: # 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'