#708 : Use default locale encoding

Use locale endoding else this generate error in GU : as default time format can have non ascii char on non english locale, but using ascii in locale can generate UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 :

In PyBitmessage/src/bitmessageqt/__init__.py"
    l10n.formatTimestamp())

In PyBitmessage/src/l10n.py", line 81, in formatTimestamp
    return unicode(timestring, encoding)
This commit is contained in:
Benoît HERVIER 2014-08-28 13:39:40 +02:00
parent 111d60dde8
commit 388bc6ba04

View File

@ -18,7 +18,7 @@ language = DEFAULT_LANGUAGE
try: try:
import locale import locale
encoding = locale.getpreferredencoding(False) or DEFAULT_ENCODING encoding = locale.getpreferredencoding(True) or DEFAULT_ENCODING
language = locale.getlocale()[0] or locale.getdefaultlocale()[0] or DEFAULT_LANGUAGE language = locale.getlocale()[0] or locale.getdefaultlocale()[0] or DEFAULT_LANGUAGE
except: except:
logger.exception('Could not determine language or encoding') logger.exception('Could not determine language or encoding')