Characters - (Newline|End of Line (EOL)|Line Separators) by OS

1 - About

Text - Non-printing Character (Tabulation, New Line, ...)

To mark line endings in text files, the following characters are used:

  • Unix/Linux file systems use newlines (\n).
  • MacOS uses carriage-returns (\r).
  • Windows uses a carriage-return followed by a newline (\r\n).

Then a line can be considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a linefeed. Supporting all possible line terminators allows programs to read text files created on any of the widely used operating systems.

The line separator used by the in-memory representation of file contents is always the newline character. When a file is being loaded, the line separator used in the file on disk is stored in a per-buffer property, and all line-endings are converted to newline characters for the in-memory representation. When the buffer is consequently saved, the value of the property replaces newline characters when the buffer is saved to disk.

Also known as Line break sequences

This characters are control characters.

3 - Tools

3.1 - jEdit

You can found them in Jedit in Utilities > Buffer Options.

3.2 - Notepad++

4 - Encoding

Platform Line Ending Xml Unicode Oracle Database Java Description
Apple Macintosh [CR] (#x000D) chr(13) \r Carriage Return
UNIX Based Systems [LF] (#x000A) chr(10) \n line-feed
DOS Based Systems [CR][LF] (#x000D)(#x000A) \r\n carriage-return/line-feed
OS/390 [NEL] (#x0085) NEL

4.1 - Java

String lineFeed = "\n";
lineFeed.equals(String.valueOf((char) 10))

5 - Documentation / Reference

data/type/text/newline.txt ยท Last modified: 2017/09/13 16:21 by 172.68.246.246