This is just the cost of using a dynamic language with implicit error handling (exceptions).
If the language assumes filenames are regular language strings, which not all do.
> Consider, for example, Windows' infamous 16-bit units that aren't actually well-formed UTF-16.
unix filenames are literally just bags of bytes with no known or specified encoding.
Except they never have? Unix paths have always been bags of bytes, both before Unicode and UTF-8 were invented and after. It's just convention that modern Unix systems use UTF-8 as the text encoding for paths.
And neither have Windows paths ever actually pretended to be UTF-16, that's my point.
https://doc.rust-lang.org/std/string/struct.String.html