do not crash when setting locale fails

Summary: lolpython

Reviewed By: akotulski

Differential Revision: D3724416

fbshipit-source-id: f69d872
master
Jules Villard 8 years ago committed by Facebook Github Bot 2
parent 40b176fd01
commit 49adf59332

@ -14,8 +14,11 @@ import locale
import os
locale.setlocale(locale.LC_ALL, '')
CODESET = locale.getlocale(locale.LC_CTYPE)[1]
try:
locale.setlocale(locale.LC_ALL, '')
CODESET = locale.getlocale(locale.LC_CTYPE)[1]
except locale.Error:
CODESET = None
if CODESET is None:
CODESET = 'ascii'

Loading…
Cancel
Save