3 ms·
But is it reasonable to treat a .txt as anything other than plain text?
by jaxn 6y ago
But is it reasonable to treat a .txt as anything other than plain text?
- Wowfunhappy 6y agoNo, it’s definitely not, that’s a separate problem!
- rualca 6y agoYou should read the article before commenting. The blog post states that the contents of said "text file" were quite literally <!DOCTYPE HTML><html><head></head><body> This is not a mere text file. At all. This is a HTML document that might be deemed valid by a very permissive validator. Just because HTML might be stored in a text file that does not mean that a noncompliant HTML file ceases to be a HTML file.
- jaxn 6y agoI read the article. I understand that. But what takes precedence, the first line or the extension.
- ben_w 6y agoIf the file extension is .txt, I always expect it to be opened as plain text. The file extension is, rightly or wrongly[0], the metadata declaring the file type — nobody would consider it reasonable for an .exe to remain executable if the extension is changed to .txt, after all. One might, possibly, still argue about the text encoding of a .txt file (I’m old enough to remember Unicode being a new fancy alternative to ASCII), but that’s about it. [0] Sometimes I reminisce about the good old days of classic Mac OS, with resource forks and separate file type metadata: https://en.wikipedia.org/wiki/Resource_fork https://en.wikipedia.org/wiki/Resource_fork
- rualca 6y ago> If the file extension is .txt, I always expect it to be opened as plain text. The file extension is, rightly or wrongly[0], the metadata declaring the file type — nobody would consider it reasonable for an .exe to remain executable if the extension is changed to .txt, after all. That statement is quite wrong and shows a good dose of ignorance. To start off in UNIX systems the extension means nothing regarding whether a file is an executable or not. All it takes is a +x flag and a file format (header, magic number) that can be executed. Also, file extensions mean nothing. In fact, a popular and very basic trick to fool clueless users to run malware (and one which any anti-malware tool checks) is to sneak executables with a different extension, because it only means something to clueless users. And a file with a txt file extensions means nothing at all. The only thing that matters is the file content and it's file permissions.