Windows: Store files without CR

On Windows: Is it possible to avoid carriage returns in KiCad files?

On Linux, and probably on Mac as well, no carriage returns are inserted when saving a file (such as a PCB saved as something.kicad_pcb). However, when the file is saved on Windows, each line contains a carriage return.
How can this Windows-specific behavior be disabled?

A text file that doesn’t use CR/LF wouldn’t be very readable, would it?

A text file that doesn’t use CR/LF wouldn’t be very readable, would it?

Of course it would be readable with no CR but LF. It works on Linux, why not on Windows?

Counterquestion: Why?

I would also prefer only one convention. However, coders have been accustomed to this problem and it has been solved in various way. First, it’s up to the editor/viewer to interpret the newlines. Choose one that supports both styles and can save whatever you choose.

For example git (and probably many diff programs) can handle newline differences. (Configuring Git to handle line endings - GitHub Docs)

As far as I know, KiCad understands both.

So, what exactly is the problem?

When using a revision control system, changing the line terminators causes every line to be marked as changed. MS Notepad was notorious for doing this; it’s one reason that programmers are (were?) told to never edit a source file with MS Notepad.

If KiCad does the same, it would result in a lot of bloat in the revision control repositories, as well as making it much more difficult to identify changes between revisions.

1 Like

Not surprisingly, git had already considered and provided solutions to the problem. A very comprehensive tutorial:

Fortunately I have only to deal with one OS so didn’t do that search until just now.