On Sat, Mar 7, 2020, at 19:31, Cameron Simpson wrote:
I *think* I understand the issues. And I can see that some software would need to work with filenames as arbitrary bytes. But that doesn't mean that you can do much with them that way.
Given that the entire UNIX filename API is bytes, I think this isn't very true.
Most real-world UNIX systems only support ASCII-compatible encodings. There's no reason not to solve the problem on such systems by using os.fsdecode(). On those few that do not (of which I don't know if any support *both* ASCII and non-ASCII-compatible encodings in locales - from what I can find, those that don't use ASCII-compatible encodings tend to exclusively use EBCDIC ones) I don't know how they handle these cases, or if python even supports any of them at all, but it seems likely that b'/' will not be the same byte as the path separator.