bpo-18378: Recognize "UTF-8" as a valid name in locale._parse_localename (GH-14736)

This commit is contained in:
Ronald Oussoren 2019-08-29 06:33:52 +02:00 committed by Ned Deily
parent fa220ec763
commit b0caf32981
3 changed files with 41 additions and 0 deletions

View file

@ -492,6 +492,10 @@ def _parse_localename(localename):
return tuple(code.split('.')[:2])
elif code == 'C':
return None, None
elif code == 'UTF-8':
# On macOS "LC_CTYPE=UTF-8" is a valid locale setting
# for getting UTF-8 handling for text.
return None, 'UTF-8'
raise ValueError('unknown locale: %s' % localename)
def _build_localename(localetuple):