| 1001010.com |
one zero zero one zero one zero dot com |
One thing that I've been made painfully aware of by working with both windows and linux concurrently is the confusion over line endings.
Line endings?
Yes, the end of a line of text in a plain text file.
I'll be honest, I've been writing dos/windows code for years - and I've never understood why lines needed BOTH 0xD (CR, \r) and 0xA (LF, \n). It just always seemed like a strange forced compatibility with line printers. Was it ever realy important to print things like "Hello\nThere" as
Hello</br> There
instead of explicitly adding the requisite spaces? I don't really know.
But that legacy just continues on and on and it looks as if it will never leave the dos/win world.
Linux seems to have learned from this - and I'm sure that there are plenty of pages out there that go into this historical implementation detail with typical fanboy zeal.
Buy why bring it up?
Well, I've noticed on quite a few occasions now that some applications (on both win and linux sides) screw up the line endings when saving back and forth. The most common effect is the sudden appearance of \r\n\n or \r\r\n in my text files.
So I would open up my hex editor to see what got fouled up and I would immediatly reminded I completely forgot the proper order of these TWO control characters! 0xA 0xD 0xD - they doesn't sound anything like newline, \r or anything. This would be followed by a "You know, I need a mnemonic for this"
For the record, here is the proper order for DOS/WIN
\r \n
0xD 0xA
CR LF
Linux doesn't do the \r 0xD CR
But wait, you said two - I see six?
That's my problem - there are two, but there are 3 names for each!
My current mnemonic choices are
"RNDA" or "Our N.D.A." for Non-Disclosure Agreement"
"R.egisterd N.urse, D.istrict A.torney"
and of course "RDNA" (Recombinant DNA), which to my dyslexic eyes sees as RNDA
But neither include CR LF - and I need one that has all of them.
....Sigh....
But maybe writing this entry will be all I need to fix the proper order in my mind once and for all. I'll see.