Re:The Python Unicode Mess
by bartwe on Saturday October 06, 2018 @12:13PM
(#18155823)
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!"
[ Parent
| on HN ]
Hi 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).
Re:The Python Unicode Mess
by ubernostrum on Saturday October 06, 2018 @11:40PM
(#18158721)
you 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.