[Python-Dev] RFC: PEP 587 "Python Initialization Configuration": 2nd version

Steve Dower steve.dower at python.org
Tue May 14 13:52:15 EDT 2019


On 10May2019 1832, Victor Stinner wrote:
> I studied code of applications embedding Python. Most of them has to
> decode bytes strings to get wchar_t* to set home, argv, program name,
> etc. I'm not sure that they use the "correct" encoding, especially
> since Python 3.7 got UTF-8 Mode (PEP 540) and C locale coercion (PEP
> 538).

It looks like Py_DecodeLocale() is available very early on - why 
wouldn't we recommend using this function? It seems to be nearly a 
drop-in replacement for mbtowcs in the samples, and if memory allocation 
is a big deal perhaps we could just add a version that writes to a buffer?

That would provide a supported workaround for the encoding issues and 
unblock people hitting trouble right now, yes?

Cheers,
Steve


More information about the Python-Dev mailing list