Skip to content

Commit

Permalink
backport macos LC_CTYPE valid value check in _locale from python3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
mattip committed Apr 24, 2024
1 parent d454f17 commit 33a90e5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib-python/2.7/locale.py
Expand Up @@ -474,6 +474,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):
Expand Down

0 comments on commit 33a90e5

Please sign in to comment.