3 ms·
While correct that also means that you cant ever correctly show filenames to users either. At somepoint you need to relate it to an encoding as a user displays
by bartwe 8y ago
While correct that also means that you cant ever correctly show filenames to users either. At somepoint you need to relate it to an encoding as a user displays or enters it. "utf-8 everywhere now!"
- Sir_Cmpwn 8y agoHi again. This was addressed in my other comment. >You shouldn't decode them except if you need to for display (and in that case, you should be prepared to handle filenames which cannot be decoded as text).
- ubernostrum 8y agoyou cant ever correctly show filenames to users either If I create a file whose name consists entirely of bytes that correspond to non-printable characters, how would you display that in the language of your choice? If I create a file whose name cannot possibly be valid UTF-8, how would you display that in the language of your choice? Both of these things are legal to do on at least some systems. Presumably you have in mind a language which will magically handle this case with no extra effort from the programmer, though, so I'm curious to know the language and what it would do.