0

I viewed some .txt on Notepad++ and Notepad. I do notice that Notepad++ reveals extra line. Does the extra line exist or not?

(I double checked, it's the same file, same version)

Note: The confrontation starts here.

Community
  • 1
  • 1
Realdeo
  • 449
  • 6
  • 19
  • 1
    ["What is the difference between \r and \n?"](http://stackoverflow.com/questions/1279779/what-is-the-difference-between-r-and-n) – Jongware Aug 29 '14 at 18:10
  • I'm lost, what difference does it makes (in notepad and notepad++)? If you follow the link, you may learn that I use `\n` =) – Realdeo Aug 29 '14 at 18:12
  • 1
    *Both* are probably right. It depends on how your line endings are encoded. Writing `\n` *does not automatically mean* you write just this one character. Examine your file with a hex editor; you might find Windows is deceiving you. – Jongware Aug 29 '14 at 18:14

2 Answers2

0

On Notepad++ click on View -> Show Symbol -> Show All Characters too view line feed and other characters.

roub
  • 16
  • It does show, '[CR]''[CR]''[LF]' but what's that supposed to mean? And more importantly, does it tell us who is correct? – Realdeo Aug 29 '14 at 18:17
  • *It does show, '[CR]''[CR]''[LF]' but what's that supposed to mean?* It means you have a non-standard text file. Why is that you might ask? Because text files generally end in one of the MS-DOS (CR-LF) Unix (LF) or OSX (CR) text file line encodings. As you can see your file does not match any of those three text line encodings. – jussij Sep 04 '14 at 01:36
0

For this .NET provides something like Environment.Newline which gives the appropriate newline character (or characters) supported in that particular environment.

This actually depends upon the editors capability of representing or displaying the characters. In some editors or platforms, '\n ' is considered to be newline while in some, '\n\r ' is considered to be the newline.

You would like to read this as well this.

Community
  • 1
  • 1
Benison Sam
  • 2,755
  • 7
  • 30
  • 40