summaryrefslogtreecommitdiffstats
path: root/Lib/locale.py
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2019-08-29 04:33:52 (GMT)
committerNed Deily <nad@python.org>2019-08-29 04:33:52 (GMT)
commitb0caf329815120acf50287e29858093d328b0e3c (patch)
treef7b3cce5c1d273c173872a45347208b39f21f0b3 /Lib/locale.py
parentfa220ec7633e9674baccc28dde987f29d7f65141 (diff)
downloadcpython-b0caf329815120acf50287e29858093d328b0e3c.zip
cpython-b0caf329815120acf50287e29858093d328b0e3c.tar.gz
cpython-b0caf329815120acf50287e29858093d328b0e3c.tar.bz2
bpo-18378: Recognize "UTF-8" as a valid name in locale._parse_localename (GH-14736)
Diffstat (limited to 'Lib/locale.py')
-rw-r--r--Lib/locale.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/locale.py b/Lib/locale.py
index f3d3973..dd8a085 100644
--- a/Lib/locale.py
+++ b/Lib/locale.py
@@ -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):