How to view (Windows) line ending characters on Mac OSX


Notepad++ on windows has this beautiful option “View all characters” to display all invisbile characters such as line endings.

Notepad++

Programming editors on mac like Textwrangler and Textmate has an option to Show Invisibles but failed to display the character block for Carriage Return as Notepad used to.

Textwrangler beats Textmate on this case where it display two special characters to refer CR and LF, where Textmate display only one character.

Textwrangler

Textmate

Our recent iPad project write csv file which is further parsed by a third party app. The 3rd party app requires the line ending to be a combination of Carriage Return (CR) and Line Feed(LF) instead of just Line Feed (LF) as traditional Unix/Mac. To test the csv generated is good, I had to view the character myself in any other editor.

After few failed attempts with both Textwrangler and Textmate, I came across this powerful unix tool called OctalDump (od) which is part of OSX.

od -c filename.csv

will display the file with C-Style escaped characters. CR as \r and LF as \n. It has numerous no. of options to explore.

od - command


Post Comment