Text Editor which shows \r\n? [closed]

2020-01-27 02:37发布

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!

17条回答
我想做一个坏孩纸
2楼-- · 2020-01-27 02:38

If you have Mathematica, you can try with this command:

ReadList["filename.txt", Record, RecordSeparators -> {}] // InputForm

That will show all the /r and /n

查看更多
姐就是有狂的资本
3楼-- · 2020-01-27 02:40

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

查看更多
Luminary・发光体
4楼-- · 2020-01-27 02:45

I'd bet that Programmer's Notepad would give you something like that...

查看更多
Summer. ? 凉城
5楼-- · 2020-01-27 02:46

GVIM runs on Windows, and there is VIM for cmd.

Check http://www.vim.org/download.php

Also, a quick look through the docs or google, or some vimmy friends can help you to use VIM's quick search and replace to fix the problem you are having I believe.

查看更多
Summer. ? 凉城
6楼-- · 2020-01-27 02:47

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).

查看更多
Viruses.
7楼-- · 2020-01-27 02:48

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

alt text

查看更多
登录 后发表回答