diff --git a/gramps/gen/utils/grampslocale.py b/gramps/gen/utils/grampslocale.py index 439d2a3ef..61e3425fe 100644 --- a/gramps/gen/utils/grampslocale.py +++ b/gramps/gen/utils/grampslocale.py @@ -415,7 +415,10 @@ class GrampsLocale(object): #Ensure that output is encoded correctly to stdout and stderr. This is #much less cumbersome and error-prone than encoding individual outputs #and better handles the differences between Python 2 and Python 3: - _encoding = sys.stdout.encoding or sys.getdefaultencoding() + try: + _encoding = sys.stdout.encoding or sys.getdefaultencoding() + except: + _encoding = "UTF-8" if sys.version_info[0] < 3: sys.stdout = codecs.getwriter(_encoding)(sys.stdout, 'backslashreplace')