Windows notepad not supporting newline character '\n'

From my iPhone application I'm outputting data from text to a file. When opened with windows notepad, the data is all on one line and where there should be a new line a block character is present (showing that it's an unrecognized character or something). When opened with windows wordpad, it displays just fine.
Would there be something wrong in my code? I'm simply output '\n' when i want a new line.

enter image description here

NOTE : It's working fine with other editors like textedit, MS Word on mac as well as on windows.


Windows default is to use \r\n as end-of-line marker. Notepad only recognises that, other text editors may know about other line-end styles and render correctly.

EDIT
As VonC answers Notepad had an update (in 2018) where it now can recognize non-Windows end-of-line sequences.


I'm simply output '\n' when i want a new line.

And starting May 2018 (6 years later), you will get a newline!

See "Introducing extended line endings support in Notepad" by Michel Lopez (and his tweet)

For many years, Windows Notepad only supported text documents containing Windows End of Line (EOL) characters - Carriage Return (CR) & Line Feed (LF). This means that Notepad was unable to correctly display the contents of text files created in Unix, Linux and macOS.

Today, we’re excited to announce that we have fixed this issue!

Starting with the current Windows 10 Insider build, Notepad will support Unix/Linux line endings (LF), Macintosh line endings (CR), and Windows Line endings (CRLF) as usual.

New files created within Notepad will use Windows line ending (CRLF) by default, but it will now be possible to view, edit, and print existing files, correctly maintaining the file’s current line ending format.

Also note that the status bar indicates the detected EOL format of the currently open file.

See an .bashrc finally displayed correctly!

https://msdnshared.blob.core.windows.net/media/2018/05/Notepad-after.png