0

I have two files - created in windows and linux. The first file has CRLF line separators, the other - LS separators. Where info about line separator can be stored? Does it depend on encoding? Looks like no..

For example notepad++ has a special section where it shows CRLF or LF. Can you at least say the name of this section to allow me continue googling on this question.

enter image description here

Biffen
  • 6,249
  • 6
  • 28
  • 36
sku144
  • 119
  • 1
  • 2
  • 10
  • 1
    It's not ‘stored’ anywhere in the file, and it has nothing to do with encodings. Editors, and other tools, just look through the file and make a guess. Are all LFs preceded by CRs? Then it's probably CRLF. Are there no CRs at all in the file? Then it's probably LF. Is there a mix of both? Then the editor probably has magic values to determine which one is in majority. And there are probably cases where it will have to give up and just not say one or the other. – Biffen Mar 09 '17 at 11:56
  • Yes, it is clear, but there is one strange thing. According to wikipedia, window uses CRLF separator symbols, unix - LF. My files were created in different systems so they have different separators. BUT. When I edit LF separated file in windows and press enters there, my editor inputs LF separator instead of CRLF, although windows should input CRFL. So I made a conclusion that there is metadata about line separator. – sku144 Mar 09 '17 at 12:04
  • 1
    Nope, no metadata. Good editors will simply make sure that pressing Enter inserts *the right* EOL, i.e. the same one it determined the file uses. Yes, Windows prefers CRLF and practically everyone else prefer LF. But this isn't about operating systems, this is about a text editor. – Biffen Mar 09 '17 at 12:05

0 Answers0