Linux binary build: If setting system default locale fails, try setting locale to en_US.UTF-8 instead

This commit is contained in:
Kovid Goyal 2010-12-20 09:55:44 -07:00
parent 10c4751b52
commit eac89c5439

View File

@ -318,7 +318,11 @@ class LinuxFreeze(Command):
import codecs import codecs
def set_default_encoding(): def set_default_encoding():
locale.setlocale(locale.LC_ALL, '') try:
locale.setlocale(locale.LC_ALL, '')
except:
print 'WARNING: Failed to set default libc locale, using en_US'
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
enc = locale.getdefaultlocale()[1] enc = locale.getdefaultlocale()[1]
if not enc: if not enc:
enc = locale.nl_langinfo(locale.CODESET) enc = locale.nl_langinfo(locale.CODESET)