IndexFAQMember listActive usersLatest postsSearch | RegisterLog in |
ROllerozxa |
ROllerozxa Site Admin
|
Posted on 2023-08-16 21:43 Link | ID: 677 |
Site Admin Posts: 229 Joined: 2022-06-04 |
Carriage Return, also known as CR, also known as \r , also known as 0x0D , is the bane of every developer working on both Unix-like and Windows systems, as well as the bane of every web developer working with forms.It all started in 1960 when Cary Returno tried to send a letter without a postage stamp, and getting it swiftly returned to sender. On that day, Mr. Returno swore to curse every computer developer with endless misery. 15 years later this became a reality. When making a new line, programs have the choice of representing the newline as one or two characters. Either simply \n (LF), or \r\n (CRLF). The latter is preferred by individuals who have been damaged by the dangers of Windows, the former is preferred by those who look beyond anything with CP/M legacy. Most programs are destined to have to deal with both, or convert to one or the other transparently.However, some programs aim to make a political statement. Windows' batchfiles treat \n as simply thin air if it is not preceded by an \r beforehand, Notepad also behaved in this manner up until recently. On the other side, the Bourne Again Shell and others make a statement in favour of LF. This is especially disturbing if you run the Bourne Again Shell on enemy turf inside the MSYS2 environment, watching in real time both sides colliding in the comfort of your computer.In a moment of brilliance by whoever decided on the web standards, they felt that web developers aren't suffering enough and decided that CRLF is the default form of newline in HTTP. It is used for newlines in HTTP headers, and it is used for form data, to the horror of any web developer who has to watch in terror as their backend parses these cursed line endings. Many code functions have been written to solve one problem - strip those damn \r characters. This code snippets originates from a mentally ill PHP developer's codebase (The illness caused either by CRLF or PHP, doctors are still uncertain about the cause):function normalise($text) { // I HATE CRLF I HATE CRLF return trim(str_replace("\r", "", $text)); } It is still unclear who will win in the line ending wars... Just kidding LF has already won, fuck CRLF. |
Compa |
Compa please just get off the internet already jamie
|
Posted on 2023-08-17 05:58 (edited 2023-08-17 05:59) Link | ID: 678 |
please just get off the internet already jamie Posts: 197 Joined: 2022-06-28 |
I always just presumed Windows did CRLF simply in a miserly attempt to break interoperability of sending .txt files and the like between Unix-based systems and WIndows-based systems. That or it was meant as some sort of compatibility hack that doesn't actually work and never did work properly. And then don't some oddball OSes only use CR endings? Maybe some early MacOS versions? |
olive | olive | Posted on 2023-08-27 21:13 (edited 2023-08-27 21:14) Link | ID: 690 |
Posts: 48 Joined: 2022-06-29 |
iirc some early Macs did LFCR, which is technically also correct from an ASCII/typewriter POV. Don't forget Unicode throwing some new newline chars in the mix intended to replace both CR & LF |
ROllerozxa |
ROllerozxa Site Admin
|
Posted on 2023-08-27 21:34 Link | ID: 691 |
Site Admin Posts: 229 Joined: 2022-06-04 |
I always just presumed Windows did CRLF simply in a miserly attempt to break interoperability of sending .txt files and the like between Unix-based systems and WIndows-based systems. That or it was meant as some sort of compatibility hack that doesn't actually work and never did work properly. Also indeed, old Macintosh pre-OS X used to use only CR for newlines, but with OS X they dragged in the Unix standard LF alongside their new BSD-based operating system. |
olive | olive | Posted on 2023-09-28 12:08 Link | ID: 705 |
Posts: 48 Joined: 2022-06-29 |
The easy solution is clearly to have everything on a single line! |
Rendered in 6.648 ms with 539KB memory used
Voxelmanip Forums (Cirrusboard) © 2022-2024 ROllerozxa, et al. |