Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Text ≠ Plain Text. TextEdit defaults to rtf. It supports html as an alternative to rtf, which is to say it can do basic formatting and nothing else.

It's perfectly reasonable to expect a text editor to support more than literal unicode, and to work with a variety of commonly-used formats.



It seems people are hunk TextEdit is the macOS equivalent of Notepad.exe while instead it’s more like WordPad


But is it reasonable to treat a .txt as anything other than plain text?


No, it’s definitely not, that’s a separate problem!


You 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.


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.

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


> 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.


I read the article. I understand that. But what takes precedence, the first line or the extension.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: