Hacker News new | ask | show | jobs
by kochthesecond 2112 days ago
> dumb blob of bytes

Well, now your filename is invalid utf8. How should programs display it or even address such a file?

3 comments

How does the UI framework act when you set a label to such payload? How does your web browser act when it sees it in HTML? I have found working on apps that see a lot of usage in varied markets that as much as we wish to see the best and ideal conditions, malformed utf-8 surfaces in the real world pretty often.
> How should programs display it

what's wrong with foo����.txt

> or even address such a file? ... by using the array of bytes ?

The fact that if one has two files, say “test{invalid bytes}.txt” and test{other invalid bytes}.txt”, both have replacement characters inserted at the same spot and would decode to the same codepoints.
It's ambiguous, for example.
so are a file named Hello.txt and another one named Нello.txt
> Well, now your filename is invalid utf8.

That's reality. An OS which can't keep up with reality is broken.