diff -r 25d78aa1ec21 Lib/locale.py --- a/Lib/locale.py Wed May 13 21:44:02 2015 -0700 +++ b/Lib/locale.py Fri May 15 11:37:16 2015 +0200 @@ -484,6 +484,10 @@ return tuple(code.split('.')[:2]) elif code == 'C': return None, None + elif sys.platform == 'darwin' and code == 'UTF-8': + # On MacOSX "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):