def select_c_utf8_bytes_locale(environ=os.environb):
"""Return a dict containing an environment that uses the C.UTF-8 locale.
C.UTF-8 is the new en_US.UTF-8, i.e. it's the new default locale when no
other locale makes sense.
This function takes a starting environment, by default that of the current
process, strips away all locale and language settings (i.e. LC_* and LANG)
and selects C.UTF-8 in their place.
:param environ: A base environment to start from. By default this is
``os.environb``. It will not be modified.
"""
environ = {
name: value for name, value in environ.items()
if not name.startswith(b'LC_')
}
environ.update({
b'LC_ALL': b'C.UTF-8',
b'LANG': b'C.UTF-8',
b'LANGUAGE': b'C.UTF-8',
})
return environ
评论列表
文章目录