[Python-Dev] PEP 540: Add a new UTF-8 mode (v2)

Jakub Wilk jwilk at jwilk.net
Wed Dec 6 10:59:44 EST 2017


* Nick Coghlan <ncoghlan at gmail.com>, 2017-12-06, 16:15:
>>>Something I've just noticed that needs to be clarified: on Linux, "C" 
>>>locale and "POSIX" locale are aliases, but this isn't true in general 
>>>(e.g. it's not the case on *BSD systems, including Mac OS X).
>>For those of us with little to no BSD/MacOS experience, can you give a 
>>quick run-down of the differences between "C" and "POSIX"?

POSIX says that "C" and "POSIX" are equivalent[0].

>The one that's relevant to default locale detection is just the string 
>that "setlocale(LC_CTYPE, NULL)" returns.

POSIX doesn't require any particular return value for setlocale() calls. 
It's only guaranteed that the returned string can be used in subsequent 
setlocale() calls to restore the original locale.

So in the POSIX locale, a compliant setlocale() implementation could 
return "C", or "POSIX", or even something entirely different.

>Beyond that, I don't know what the actual functional differences are.

I don't believe there are any.


[0] http://pubs.opengroup.org/onlinepubs/9699919799/functions/setlocale.html

-- 
Jakub Wilk


More information about the Python-Dev mailing list