Windows Notepad and Notepad++ show newlines in same file differently

newlinesnotepadtext-editorswindows

I created a Perl script which gets some data and inserts it line by line into a text file. When I open that file with Notepad++, it appears to have an empty line separation between each two lines of text, for example:

AAVX    Etracs Daily Short 1 Month S&P

ABCS    Guggenheim Abc High Dividend Et

ABI     Safety First Trust

However, if I open the same file with the standard Windows notepad, it appears without the spaces, as follows:

AAVX    Etracs Daily Short 1 Month S&P
ABCS    Guggenheim Abc High Dividend Et
ABI     Safety First Trust

The question is: Which one of notepads should I trust and why does it happen?

Best Answer

This happens when the EOL control characters are not correct. Windows represents newlines with the carriage return + line feed.

In Notepad++, you can check for these characters by selecting:

View > Show Symbols > [x] Show End of Line

notepad++

You need to modify your script so your data is formatted like this:

CRLF

Related Question