Created
November 24, 2012 03:51
-
-
Save cou929/4138273 to your computer and use it in GitHub Desktop.
locale で 'ValueError: unknown locale: UTF-8' というエラーがでた
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')): | |
# 略 | |
import os | |
lookup = os.environ.get | |
for variable in envvars: | |
localename = lookup(variable,None) | |
if localename: | |
if variable == 'LANGUAGE': | |
localename = localename.split(':')[0] | |
break | |
else: | |
localename = 'C' | |
return _parse_localename(localename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment