Alexandre Vassalotti wrote:
> Alexandre Vassalotti added the comment:
>
> I thought of another way to implement PyUnicode_DecodeFSDefault. If
> Py_FileSystemDefaultEncoding is set, decode with the codecs module,
> otherwise use UTF-8 + replace. This works because when
> Py_FileSystemDefaultEncoding is initialized at the end of
> Py_InitializeEx(), the codecs module is ready to be used. Here's what
> it looks like:
That's almost what I had in mind but with two exceptions for __APPLE__
and MS_WINDOWS. For both OS the value of Py_FileSystemDefaultEncoding is
hard coded to UTF-8 / MBCS. In your code the method would use
PyUnicode_Decode() too early but you can work around the problem with
two #if defined.
Christian |