Windows uses values 0D 0A to signify a line-break. Mac uses 0A.
TIL—Windows XP had a bug causing Notepad to insert 0D 0D 0A. It wouldn't save like that, but if you copied and pasted the contents elsewhere the bytes could be preserved to this day.
Computers are hard 🙂
Oh, wait... does Windows 10 use 0A now?
`a
b`.split('').map(x => x.charCodeAt(0).toString(16))
Which produces
["61", "a", "62"]
Or maybe this is JavaScript normalizing it?
I assume 0A alone is enough to force a new line in Windows, but that Windows still uses 0D 0A. I ran:
copy([ '61', '0A', '62' ].map(x => String.fromCharCode(parseInt(x, 16))).join(''))
And pasted from the clipboard into Notepad, and it showed the expected line-break. Odd.
This is confusing. I'm viewing a file as HEX and I see the 0D 0A markers. Copying the content as ASCII and I see only 0A coming over. It's like the 0D bytes just vanish in the process.
The End-of-Line Story
RFC Editor, 18 April 2004
rfc-editor.org/old/EOLstory.t…
Share this Scrolly Tale with your friends.
A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.
