diff --git a/src/GrampsLocale/_GrampsLocale.py b/src/GrampsLocale/_GrampsLocale.py index 5b34e7aee..46e71a4db 100644 --- a/src/GrampsLocale/_GrampsLocale.py +++ b/src/GrampsLocale/_GrampsLocale.py @@ -132,7 +132,7 @@ try: except: import time - if constfunc.win(): + if constfunc.win() or constfunc.mac(): codeset = locale.getlocale()[1] else: codeset = locale.getpreferredencoding() diff --git a/src/MacTransUtils.py b/src/MacTransUtils.py index 615c3e9f6..6a73f246b 100644 --- a/src/MacTransUtils.py +++ b/src/MacTransUtils.py @@ -260,3 +260,4 @@ def mac_setup_localization(dir, domain): lang = mac_resolve_locale(collation) if lang != None: os.environ["LANG"] = lang + os.environ["LC_CTYPE"] = lang + ".UTF-8" diff --git a/src/Utils.py b/src/Utils.py index beb354b3e..7d35ac312 100644 --- a/src/Utils.py +++ b/src/Utils.py @@ -129,7 +129,10 @@ def fix_encoding(value): return unicode(value) except: try: - codeset = locale.getpreferredencoding() + if constfunc.mac(): + codeset = locale.getlocale()[1] + else: + codeset = locale.getpreferredencoding() except: codeset = "UTF-8" return unicode(value, codeset) @@ -308,7 +311,9 @@ def find_file( filename): # Build list of alternate encodings encodings = set() - + #Darwin returns "mac roman" for preferredencoding, but since it + #returns "UTF-8" for filesystemencoding, and that's first, this + #works. for enc in [sys.getfilesystemencoding, locale.getpreferredencoding]: try: encodings.add(enc)