This would be an issue and implementation for Linux systems, but
would not need to be used on systems such as MacOS (which defines a
particular encoding) or Windows (which defines a particular
encoding) etc. When mounting filesystems that use byte string file
names on systems with a define encoding, it should be the
responsibility of the mounting system to do such transformations,
and possibly have such configurations, and possibly have mappings or
renaming facilities, and possibly prohibit access to files whose
names cannot be transformed (of course, one can always punt by
configuring latin-1 or other encodings that can match any byte
string, but that produces mojibake, and then there is no surety that
particular files will appear to have the name that programs expect).
Of course, Victor's patch is addressing Windows issues, and Windows
has defined encodings, it is just a matter of using the proper APIs
to see them, and should be accepted.
It sounds like the current situation on Linux is that Python can
access the subset of files that match the locale encoding for which
it is run. It sounds like it would be inappropriate for Python to
begin shipping files with non-ASCII names as part of its Linux
distribution, unless facilities are created or tools used to remap
non-ASCII names to the local locale encoding. Locales that are not
ASCII supersets (in character repertoire, not encoding) could not be
supported. Locales that do not support all the characters used in
files shipped with Python could not be supported. Since locales
vary wildly in their available non-ASCII names, that limits Python
eithr to shipping ASCII names only, or restricting the locales that
are supported to those that support the characters used.
I suppose that Victor's patch would point out most or all the
places where such transformations would have to be implemented, if
it is important to support systems having byte string file names
whose users cannot agree to use a single encoding for transforming
to/from characters.