Text Editor which shows \r\n?

196,698

Solution 1

With Notepad++, you can show end-of-line characters. It shows CR and LF, instead of "\r" and "\n", but it gets the point across. However, it will still insert the line breaks. But you do get to see the line-ending characters.

To use Notepad++ for this, open the View menu, open the Show Symbols slide out, and select either "Show all characters" or "Show end-of-line characters".

enter image description here

Solution 2

In vi(m), check out:

:help 'list'
:help 'listchars' 

Solution 3

Sublime Text 3 has a plugin called RawLineEdit that will display line endings and allow the insertion of arbitrary line-ending type:

https://github.com/facelessuser/RawLineEdit

Solution 4

On the Windows platform the Zeus editor has an option to display white space (i.e. View, White sapce menu).

It also has an option to display the file in hex mode (i.e. Tools, Hex Dump menu).

Solution 5

You can get this in Emacs by changing the mode. For example, here is what things look like in Whitespace mode.

alt text

Share:
196,698
NickAldwin
Author by

NickAldwin

Disclaimer: The man in the picture is not intended to represent NickAldwin's actual appearance. Any similarities between Dr. Strangelove and NickAldwin are completely coincidental.

Updated on July 08, 2022

Comments

  • NickAldwin
    NickAldwin almost 2 years

    I'm looking for a text editor that can show me the actual carriage returns and newlines.

    E.g. if I save this string: "This\rIs\r\nA\nString"

    Instead of showing

    This
    Is
    A
    String
    

    I'm looking for some text editor which will show

    This\rIs\r\nA\nString
    

    I believe a problem with my text-file parsing in a certain program is being caused by inconsistent newline/carriage return/both on the ends of lines.

    I could just make a program which can read a file and display it with that formatting, but I figured it'd be easier if anyone knew of one that can already do it.

    Thanks!

    [EDIT]
    Forgot to specify I'm on Windows, and installing Cygwin isn't really an option. Otherwise I would use vi or vim.
    Also, if there's a way to do this in PSPad, which is already installed, it would be awesome if you knew that too. Thanks!

    • paxdiablo
      paxdiablo over 14 years
      Cygwin is not a prereq for Vim. gVim runs fine on native Windows.
  • paxdiablo
    paxdiablo over 14 years
    I challenge you to write that program in any language in a second :-)
  • Cem Kalyoncu
    Cem Kalyoncu over 14 years
    ok, a small typo, it should be 10
  • Cem Kalyoncu
    Cem Kalyoncu over 14 years
    Don't vote me down, this is a valid solution, after all this is why PERL is created. Most importantly you can improve this method to search for any inconsistencies within a directory containing many files.
  • NickAldwin
    NickAldwin over 14 years
    But I did say "I could just make a program which can read a file and display it with that formatting, but I figured it'd be easier if anyone knew of one that can already do it." (but I didn't vote you down).
  • NickAldwin
    NickAldwin over 14 years
    Thanks. Here I've been using PSPad for years, preferring it over Notepad++, and now it fails me. Not only that, but there's a forum post where people are pleading the author to add that feature, and he basically tells them to go away. Maybe I'll consider switching to Notepad++...
  • MBarbosaEng
    MBarbosaEng over 11 years
    The PSPad shows special characters: PSPad.com
  • Avatar
    Avatar over 9 years
    Thanks for reminding me that it is under View > Show Symbol. Tip: Notepad++ is also great for finding characters and replacing them with line breaks, see details at superuser.com/q/34451/169199
  • M. Beausoleil
    M. Beausoleil over 7 years
    I really like the command od -c filename.csv. This one is working on the Terminal app. dr-palaniraja.blogspot.ca/2011/06/…
  • Manius
    Manius over 6 years
    8 years later... looks a bit outdated until some theme/font size changes (GTK+ FTW) but it still compiles fine. Java based editor, pretty cool! Somewhat impressed by this little project, handles large files faster than anything I've tried so far, very fast in general, and feature packed. Good one!
  • Simulant
    Simulant about 5 years
    After installing the plugin, how do I activate it that is shows the line endings?
  • Jim Aho
    Jim Aho about 5 years
    shift + ctrl + p is usually the way in Sublime to interact with plugins. Press these keys and start type the name of the plugin, you'll see the result.