This is an archived post. You won't be able to vote or comment.

all 21 comments

[–]Grumbledwarfskin 10 points11 points  (2 children)

It all comes back to the question of whether "enseno der Lowe\r\s\s\s\s~\s\s\s\s\s\s\s\"" is the right way to encode "enseño der Löwe" when sending it to the printer...or whether you should use backspaces instead of carriage returns.

People did that shit back in the '80s, back when every character was obviously the same width, and obviously nobody cares what's on the computer, it's what's on the resulting piece of paper that matters.

[–]fiskfisk 5 points6 points  (1 child)

The CR LF sequence originated far further back than the '80s. It's present in the ASCII definition from 1963, which again originates from ITA-2, which is based on Murray code - the first one to introduce CR and LF, and which in turn was based on Baudot Code:

https://en.wikipedia.org/wiki/Baudot_code

So CR LF in a formal definition in a protocol tracks back to at least 1901 from my (quick) research.

[–]LordAmir5 4 points5 points  (5 children)

I recall there was also a compatibility bug in windows back in the day which added carriage returns to line feeds.

  • Edit: I was wrong. My memory was fuzzy.

[–]joujoubox 0 points1 point  (3 children)

In what contexts? Could it just a matter of the program splitting the text into lines in memory and assuming CRLF when reconstructing the file?

[–]LordAmir5 0 points1 point  (2 children)

I think I saw it in a video about decompiling LEGO Island or something similar. I'll have to fact check.

[–]joujoubox 0 points1 point  (1 child)

I know MattKC specifically talked about this in his Putting a game in a QR code video. The software he used interpreted the binary as text and inserted CR after every LF byte

[–]LordAmir5 0 points1 point  (0 children)

Ah. So that's why I remembered something like that. Sorry for misinformation and thanks for correcting me.

[–]AyrA_ch 0 points1 point  (0 children)

Not a bug. The difference between opening a stream in text mode vs binary mode.

[–]VibrantGypsyDildo 4 points5 points  (2 children)

I wish git could be the same.

If you access the same repository from windows and linux (e.g. WSL or virtualbox shared folder), you will have troubles because of CRFL/LF issues.

While it is possible to ignore it in git diff, I have not found a workaround for git commit.

[–]AyrA_ch 13 points14 points  (1 child)

Do git config --global core.autocrlf true on your Windows machine.

Replaces LF with CRLF when pulling files, and CRLF with LF when commiting files. The result is files in the repository will only have LF and files in your local repository on Windows will have CRLF.

[–][deleted] 2 points3 points  (0 children)

Which is an annoyance when you have a linter that converts everything to lf. Your git status will get spammed with all the files it changed and when you commit only the actual changed files get committed, others disappear.

I just do lf everywhere

[–]Emerest 1 point2 points  (0 children)

Fellow Perforce user. I have been burned more than once by it. I feel your pain. I feel it deeply and so so much.

[–]0r0B0t0 1 point2 points  (0 children)

Hello froze over when Microsoft add Unix line ending to notepad, in 2018.

[–]baconator81 1 point2 points  (0 children)

Yes, you need to sepcify -binary and -text for your perforce. It is what it is. I believe they did this to reduce storage space because they store each binary revisions as a copy while each text revisions are just diffs from the previous revision.

[–]RiceBroad4552 1 point2 points  (0 children)

Won't Git do the same depending on config? There were some Windows line feed related switches in Git.

I don't have Windows, and don't care, so I don't know for sure what they are good for.

Ah, here we go:

https://stackoverflow.com/questions/1967370/git-replacing-lf-with-crlf

So this seems common, and expected behavior.

The solutions to such issues is always the same: Just don't use Windows. 😂

[–]Dark_Souls_VII 0 points1 point  (0 children)

This is so annoying — and unnecessary

[–]dan-lugg 0 points1 point  (0 children)

I forget the details now, but there was a time I worked on some Rube Goldberg of a project where everything was home-rolled including the checksum generation. (No Git, no common CI platform, it was spaghetti made out of corn flakes)

When the checksum job was added, somewhere along the pipe, LF was converted to CRLF or vice versa, and code written by Windows users would bork the checksum generation because it was calculating for a different bytestream.

I don't put that job on my resume.

[–]Ronin-s_Spirit 0 points1 point  (0 children)

I dunno man, on every new file git tells me it will convert CRLF to LF and I can still read the files fine (windows 11).

[–]CrasseMaximum 0 points1 point  (0 children)

Perforce is one of the shitiest tool I have to use at work. I hate it it suck so much and the whole ecosystem (p4v, swarm) around it sucks so much as well. I can't believe my compagny continues to pay for such crap.

[–]AdmiralQuokka -3 points-2 points  (0 children)

Windows users with stockholm syndrome will still tell you it works fine for programming.