This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lemburg
Recipients Jan Niklas Hasse, Sworddragon, abarry, akira, barry, ezio.melotti, lemburg, methane, ncoghlan, r.david.murray, vstinner, yan12125
Date 2017-01-05.09:51:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <d81609e1-2c27-5845-2581-5c6c204b798d@egenix.com>
In-reply-to <1483608382.57.0.914601332406.issue28180@psf.upfronthosting.co.za>
Content
On 05.01.2017 10:26, Nick Coghlan wrote:
> 
> Anything purely on the Python side of things doesn't work in a traditional C environment - CPython relies on the C lib to do conversions during startup, so we need the C locale to be set correctly. We can do things differently on Mac OS X and iOS because Apple ensure that *C* behaves differently on Mac OS X and iOS (and apparently Google do something similar for Android, so I'll update the PEP to mention that as well).

I believe IANADA-san (hope that's the right way to address him)
raised a good point though: what if a system doesn't come with
the C.UTF-8 local setup ?

The C lib would then error out when trying to use setlocale()
on such an environment.

Now, Python's main() function doesn't look at any such errors
(and neither do the other places which use it such as frozenmain.c
and readline.c), so it wouldn't even notice.

The setlocal() man-page doesn't mention how such a failure would
affect the current locale settings. My guess is that the locale
remains set to what it was before, which in case of a fresh C
application start is the "C" locale.

So in the implementation of the PEP, there should be a test
to see whether "C.UTF-8" does result in a successful
call to setlocale(). If it doesn't, there would have to be
some work-around to still make Python's FS encoding happy
while leaving the C lib locale set at "C".
History
Date User Action Args
2017-01-05 09:51:21lemburgsetrecipients: + lemburg, barry, ncoghlan, vstinner, ezio.melotti, r.david.murray, methane, akira, Sworddragon, yan12125, abarry, Jan Niklas Hasse
2017-01-05 09:51:21lemburglinkissue28180 messages
2017-01-05 09:51:21lemburgcreate