Windows Notepad Not Supporting Newline Character '\ n'

From my iPhone application, I output data from text to file. When you open using Windows Notepad, the data is all on the same line and where the new line should be, there is a block symbol (indicating that it is an unrecognized character or something else). When opened using Windows Wordpad, it displays just fine.
Will there be something wrong in my code? I just output '\ n' when I want a new line.

enter image description here

NOTE. It works great with other editors such as textedit, MS Word on Mac, as well as windows.

+10
objective-c iphone newline text-files
source share
4 answers

On Windows, \r\n used by default as the end of line marker. Notepad only recognizes what other text editors can know about other line-end styles and display correctly.

+13
source share

This is because \n does not represent a complete line break in Windows. Using \n is the "Unix" way of doing line breaks.

Windows has text editors like Notepad ++ that handle both, but Notepad is really dumb in this regard.

I suggest you create a setting in the iPhone application where the user can choose between the end of the Windows and Unix line - then this is his responsibility :-)

+2
source share

I just output '\ n' when I want a new line.

And starting in May 2018 (6 years later) you will receive a new line!

See Michel Lopez’s Notepad Enhanced End-of-Line Support (and his tweet )

For many years, Windows Notepad only supported text documents containing Windows End of Line (EOL) characters - carriage return (CR) and line feed (LF). This means that Notepad was unable to correctly display the contents of text files created on Unix, Linux, and macOS.

Today we were pleased to announce that we fixed this problem!

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

New files created in Notepad will use the Windows line ending (CRLF) by default, but now you can view, edit and print existing files correctly supporting the current line format.

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

See .bashrc finally displaying correctly!

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

+1
source share

wow is something that 1980 cannot understand \ n, probably the only application left in the modern era that is still waiting for \ r \ n

-one
source share

All Articles