This commit is contained in:
Kovid Goyal 2012-04-07 19:22:02 +05:30
parent d58de47f0e
commit df3896d585

View File

@ -48,6 +48,18 @@ fcntl = None if iswindows else importlib.import_module('fcntl')
filesystem_encoding = sys.getfilesystemencoding()
if filesystem_encoding is None: filesystem_encoding = 'utf-8'
else:
try:
if codecs.lookup(filesystem_encoding).name == 'ascii':
filesystem_encoding = 'utf-8'
# On linux, unicode arguments to os file functions are coerced to an ascii
# bytestring if sys.getfilesystemencoding() == 'ascii', which is
# just plain dumb. So issue a warning.
print ('WARNING: You do not have the LANG environment variable set. '
'This will cause problems with non-ascii filenames. '
'Set it to something like en_US.UTF-8.\n')
except:
filesystem_encoding = 'utf-8'
DEBUG = False