def make_utf8_env():
 global _CACHED_ENV
 if (not _CACHED_ENV):
  lang_re = re.compile('\\.([^@]*)')
  env = os.environ.copy()
  lang = env.get('LANG', DEFAULT_LANG)
  if lang_re.search(lang):
   lang = lang_re.sub('.UTF-8', lang)
  else:
   lang = DEFAULT_LANG
  env['LANG'] = lang
  _CACHED_ENV = env
 return _CACHED_ENV

def make_utf8_env ( ) : global _CACHED_ENV if ( not _CACHED_ENV ) : lang_re = re . compile ( '\\.([^@]*)' ) env = os . environ . copy ( ) lang = env . get ( 'LANG' , DEFAULT_LANG ) if lang_re . search ( lang ) : lang = lang_re . sub ( '.UTF-8' , lang ) else : lang = DEFAULT_LANG env [ 'LANG' ] = lang _CACHED_ENV = env return _CACHED_ENV
communication with child processes is in utf8 .