Opening a Unix text file on Windows

Problem: If you save a multiple-line text file on Unix (e.g. Linux) and open it on Windows, the text editor ignores the link breaks and shows the content in one giant line.

Cause: Different operating systems use different characters to mark the end of line (a.k.a. link break). E.g. Mac OS up to version 9 uses CR (ASCII character #13), Unix (e.g. Linux, Mac OS X) uses LF (ASCII character #10) and Windows uses 2 characters: CR followed by LF. See the Wikipedia page for details.

Some text editors cannot handle “foreign” line breaks. E.g. If Notepad (Windows’ default text editor) opens a text file, it assumes all lines end with CR-LF. If it is given a text file saved in Unix (which contains LF characters but not CR-LF sequences), it would not find any CR-LF and assumes there is no line breaks. Therefore, it displays the whole text file in a single line.

Other editors (e.g. Windows’ WordPad) tries to auto-detect the line break characters used in the text file. Therefore, they can open text files saved in other operating systems correctly.

Solution: On Windows, opening the file with Wordpad instead solves the problem. If you need to do this frequently, consider replacing NotePad with one of its replacements.