6 ms·
And, after that, kill CR LF as a line separator. That's an idea which belongs to the era of mechanical Teletype machines.
by Animats 11y ago
And, after that, kill CR LF as a line separator. That's an idea which belongs to the era of mechanical Teletype machines.
- nivla 11y agoYa that I too agree with this, pretty much all applications can now deal with \n just fine. Having CR LF (2 Bytes) is not only wasting storage space but also wasting bandwidth when transmitting. While at it, I also wish if Linux distros could get done with case sensitiveness in filenames. Is there any advantage to allowing both Filename.ext and filename.ext? The only time I seen this is when a malware is trying to stay hidden. Also some naming conventions would be nice, when you can have any character including '/' and '.' as a filename, it gets annoying to deal with them in a cli.
- jonathankoren 11y ago> Is there any advantage to allowing both Filename.ext and filename.ext? Sorting by ascii order put capitalized files to the top of the list. Exactly where you should look for important stuff like README and Makefile. Case preservation without case sensitivity is just dumb. Why bother, because it's pretty? Also, what's up with spaces in filenames? And furthermore, what are all these kids doing on my lawn?
- wlesieutre 11y ago> Also, what's up with spaces in filenames? What's_up_with_spaces_at_all? Let's_just_join_sentences_with_underscores_for_clarity.
- capote 11y ago> not only wasting storage space but also wasting bandwidth when transmitting Such an utterly minuscule amount though (especially in the modern times when storage and bandwidth are cheap and ubiquitous), I think you typing that sentence has wasted more storage and bandwidth. I think a better reason is to avoid issues when working with code files across systems and version control. This actually causes major annoyance.
- unimpressive 11y ago>Such an utterly minuscule amount though Sent a bazillion and one times all day, every day. I'm sure it adds up.
- capote 11y agoAnd it's still minuscule, even added up, even a billion times over. My point is that there's no shortage of digital storage space and bandwidth is only getting better. And if CRLF does cause a shortage of storage and bandwidth, I'm sure MS would address it.
- rhinoceraptor 11y agoIt's not a Linux distro thing, all Linux, BSD, Solaris, etc systems are case sensitive because it's the 21st century. The only widely used file system without case sensitivity is HFS[1]. NTFS to its credit is case sensitive, but Win32 is not, for legacy reasons (same reason as why MAX_PATH still plagues Windows). [1]: https://en.wikipedia.org/wiki/Comparison_of_file_systems#Features https://en.wikipedia.org/wiki/Comparison_of_file_systems#Fea...
- mrsteveman1 11y agoAnd if you actually go out of your way to try and use the case sensitive HFS+ on a Mac, you have a pretty good chance of getting tripped up by user space software that doesn't like it, like Photoshop[1]. [1] https://helpx.adobe.com/creative-suite/kb/error-case-sensitive-drives-supported.html https://helpx.adobe.com/creative-suite/kb/error-case-sensiti...
- rkeene2 11y agoZFS supports being case-insensitive.
- wlesieutre 11y agoI recently had to deal with this for writing a file format that mandates CR LF line endings regardless of platform. Thankfully, Python 3 makes it painless to deal with, once you track down how. For anyone who's been spared so far: file = open(path, "w", newline="\r\n")
- kevin_thibedeau 11y agoAlso usable from 2.7 with backported and forward compatible io.open().
- deleted 11y ago[deleted]
- epsylon 11y agoWhich one do we use then? CR or LF?
- gberger 11y agoLF, of course. That's what POSIX systems use.
- kevin_thibedeau 11y agoTechnically it's recast as NL.
- skissane 11y agoCR LF is the Internet standard, however. TELNET, SMTP, FTP, and most significantly HTTP/1.1 all specify CRLF is to be used as the line terminator (not LF). Many popular implementations will accept a bare LF as well, but messages containing a bare LF are strictly not standards conforming. Given this is fixed in RFCs, it is unlikely to ever change
- stormbrew 11y agoThis is not why Windows uses CRLF, nor is it some original reason that is now obsolete. It was standard for both DOS' predecessors and early internet standards because teletypes considered carriage return and linefeed separate commands, and both were built to operate with those things. None of that stopped UNIX from getting away from it, and the internet is basically built on UNIX. What transformations the C FILE stream implementation makes to linefeeds has nothing at all to do with TELNET, SMTP, FTP, or HTTP. These are very separate areas of concern. In Windows if you're writing socket code you have to explicitly write the \r and the \n, just like on any other platform.
- WalterBright 11y agoCRLF comes from DEC operating systems. DOS was inspired by CP/M which was inspired by DEC operating system conventions. (CP/M operates remarkably like RT-11. DIR, COPY, etc., all come from DEC.)
- pvg 11y agoDEC's usage likely comes from Teletypes, though. https://en.wikipedia.org/wiki/Newline#History https://en.wikipedia.org/wiki/Newline#History
- skissane 11y ago"the internet is basically built on UNIX" is an odd thing to say. In the early days of the Internet (early 1980s, 1970s if we want to include ARPANET as the current TCP/IP-based Internet's predecessor), it was a very diverse place, with lots of DEC operating systems (TOPS-20, VMS), IBM mainframes, and various other mainframe and minicomputer vendors, with Unix by no means predominating. The Unix monoculture (and later Unix/Windows biculture) grew through the 1980s and was well-established by the 1990s. Major protocols such as IP, TCP, UDP, TELNET, FTP and SMTP were all developed prior to that Unix monoculture taking hold. FTP in particular shows the pre-Unix heritage very clearly, with support for record-oriented filesystems (STRU R, MODE B, MODE C) for DEC and IBM operating systems, support for systems that don't use 8-bit bytes (e.g. TYPE L36), built-in ASCII-EBCDIC translation (TYPE A and TYPE E), support for ASA carriage control (TYPE A C and TYPE E C), and support for TOPS-20 paged files (STRU P). (These are all features pretty meaningless on Unix systems, which is why Unix FTP clients and servers largely do not implement them.)
- xorblurb 11y agoAnd switch from UTF-16 to UTF-8, like everybody else on the planet. Or at least provide a completely working UTF-8 codepage...
- mc808 11y agoAnd silently delete that inane byte order mark anywhere it appears, at least within Visual Studio.
- MichaelGG 11y agoThe BOM has to be one of the stupidest things they've done. Such a terrible idea. Yes, I know they wanted an easy way to detect encoding, but corrupting data is just beyond bad.
- ygra 11y agoExcept that U+FEFF is specified to be only used as byte-order indicator when appearing at the start of a text stream and does not belong to the text content. It does not corrupt data because it's not part of the data for any conforming application. Non-conforming applications doing wrong things because they don't bother to follow the standard is hardly surprising, then. Yes, Unicode is messy and could have been better designed (it was designed so that there is an easy conversion path for any pre-existing encoding – thus concerned itself more with making it easy to convert content in legacy encodings to Unicode, instead of making it easy to implement applications in a way that they support Unicode), but it's still orders of magnitude better than anything that came before it when it comes to representing text in general. And it's mostly complicated because languages and scripts are complicated.
- MichaelGG 11y agoOK, then I cat two files together. Somehow thinking that one can unilaterally declare every application in the world as "non-conforming" is just sticking your head in the sand.
- ninkendo 11y agoWhile we're at it, we can kill that double-byte UCS-2 nonsense that microsoft retconned to be UTF-16. Microsoft must have thought to themselves in the early 90's: "Gee, we should support unicode... that means we need wider characters, right? Two bytes ought to be enough. Ship it!" Then when it became clear that two bytes wasn't enough, they didn't want to replace all the types for those win32 API calls, so they said "Well, let's just pretend that the two-byte encoding was actually UTF-16 all along", which is both variable width (which has all the problems UTF-8 has with invalid encodings), and it's wasteful in size (all ASCII text is stored with two bytes per character). It's literally the worst of both worlds.
- 0x0 11y agoJava and javascript have the same design flaw, though.
- ygra 11y ago> Microsoft must have thought to themselves in the early 90's: "Gee, we should support unicode... that means we need wider characters, right? Two bytes ought to be enough. Ship it!" Except it was Unicode which was a 16-bit code back then which got changed into 21 bits with Unicode 2 which also morphed UCS-2 into UTF-16. This happened in 1996, when Windows NT already existed. Blaming Microsoft (and Sun, and Netscape, ...) to follow a standard is a bit out of place. Heck, while UTF-8 everywhere would be nice, things are still messy and various different encodings are rampant. At least UTF-16 is immediately recognisable, as opposed to all the legacy encodings.
- ninkendo 11y agoI suppose that's right. It's really the Unicode 1.0 standard itself that's to blame here, but the point still stands. It took them between 1.0 and 2.0 to actually include any implementation guidelines, but by then it was too late; the Microsofts and Suns of the world have already implemented a dead-end way of encoding the standard. But at least in Unicode 2.0 in 1996, the definitions they finally gave were UTF-7 and UTF-8. UTF-16 didn't become standard until 3.0 in 1999, when it became apparent that they couldn't take the first 5 years back, and too much software was already written assuming 16-bit characters. My point is that UTF-16 is a completely worst-of-both-worlds hack that nobody would implement in a vacuum, short of a need to maintain compatibility with a 2-byte character API. The only reason it exists is because people (the Consortium included) truly for a brief period thought a 2-byte character set would actually be enough, and then had to figure out a way to preserve compatibility later. Meanwhile the UNIX world thankfully seems to have gone straight from ASCII to UTF-8 without any awkward dead-end in the middle [1], because if you need to maintain backward compatibility with anything, it's a lot more useful (and space efficient) for that something to be ASCII. [1] Sure, there exists wide-character versions of all the posix standard APIs, but in practice all the other API's you're likely to use in UNIX land have converged around wrapping the 8-bit character versions.
- evincarofautumn 11y agoA terminal does (kind of) emulate a teletype. Certain formatting operations would be easier if a line feed character meant exactly “line feed”. Ditto vertical tab. I agree it doesn’t really belong in a storage encoding, though.
- Stratoscope 11y agoJust be grateful that it's only CR LF and not CR LF RUBOUT. That would really have been too much skeuomorphism in our text file format. What is RUBOUT? It's a character with all 1 bits. On a paper tape, a punched hole represents 1 and lack of a punch is 0. So a RUBOUT character has all the holes punched out. And by convention, RUBOUT is ignored when a tape is read. If you made a mistake punching a tape, you would type BACKSPACE RUBOUT. BACKSPACE wasn't a character itself; it would physically back up the tape by one character position. RUBOUT then punched out all the holes, in effect erasing that character. To go to the next line, you would punch RETURN to return the print carriage to the beginning of the line, and LINE FEED to feed the paper to the next line. But unless you were daring, you'd follow these with a RUBOUT to give the machine a little more time for all this mechanical movement.
- JdeBP 11y agotermios(3) on Linux operating systems has newline and carriage return delays to this day.