能够查看隐形的文本编辑器? [英] Text editor capable of viewing invisibles?

查看:36
本文介绍了能够查看隐形的文本编辑器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近的一个问题*让我想知道是否有一个文本编辑器可以让您看到文件的每个字符,即使它们是不可见的?具体来说,我不是在寻找十六进制编辑功能,我对一个文本编辑器感兴趣,它会向我显示所有不可见的字符(不仅仅是常见的空格/换行符).BOM 标记 只是一个例子,其他的例如数学隐形 或者可能是 不支持的字符.

A recent problem* left me wondering whether there is a text editor out there that lets you see every single character of the file, even if they are invisible? Specifically, I'm not looking for hex editing capabilities, I am interested in a text editor that'll show me all of the invisible characters (not just the common whitespace / line break characters). The BOM marker is just one example, others are e.g. mathematical invisibles or possibly unsupported characters.

我不是在寻找仅支持多种文本编码/编码之间翻译的文本编辑器.我遇到的所有文本编辑器都会正确处理不可见字符,即让它们不可见(或者像 BOM 标记一样在翻译中被删除).

I'm not looking for a text editor that simply supports a large variety of text encoding / translations between encodings. All text editors I've come across treat the invisible characters correctly i.e. leave them invisible (or simply get removed in the translation as in the case of the BOM marker).

我问这个问题主要是出于学术兴趣,所以我对任何特定的操作系统都不挑剔.我可以轻松地测试 Linux 和 OSX 解决方案,但如果您推荐一个 Windows 编辑器,如果您能描述编辑器如何处理除空格/换行符以外的不可见内容,我将不胜感激.

I'm asking this mostly out of academic interests, so I'm not particular about any specific OS. I can easily test Linux and OSX solutions, but if you recommend a Windows editor, I would appreciate if you include descriptions of how the editor handles invisibles other than whitespace / line breaks.

我开始确定我想要的行为可以通过自定义突出显示或通过弄乱字体本身在 emacs/vim 中实现.这种类型的解决方案也是可以接受的.

I'm beginning to be sure that the behavior I want can be implemented in emacs/vim via either custom highlighting or by messing around with the font itself. A solution of this type would also be acceptable.

在查看了几个选项后,我发现 TextMate 至少显示了一个空格,其中文件中存在一个不可见的 UTF-8 字符.对 SO 回答我的问题的能力感到有些失望.赏金归 VIM,因为这是最有可能解决方案的方向.

After looking at several options I found TextMate which at least shows a blank space where an invisible UTF-8 character is in the file. Slightly disappointed with SO's ability to answer my question. Bounty goes to VIM, because that is the direction in which the solution most likely lies.

*导致我提出这个问题的事件:我使用 TextWrangler 编写了一个 perl 脚本,并设法将编码更改为 UTF8 BOM,这会在文件的开头插入 BOM 标记.Perl(或者更确切地说是操作系统)很快就会错过 #!混乱接踵而至.然后我花了一个下午的大部分时间才弄清楚这一点,因为即使打开了各种显示不可见"选项,大多数文本编辑器也不显示 BOM 标记.现在我已经吸取了教训,将立即使用 less :-).

*The incident that lead me to this question: I wrote a perl script using TextWrangler and managed to change the encoding to UTF8 BOM, which inserts the BOM marker at the start of the file. Perl (or rather the operating system) promptly misses the #! and mayhem ensues. It then took me the better part of an afternoon to figure this out since most text editors do not show the BOM marker even with various "show invisibles" options turned on. Now I've learned my lesson and will use less immediately :-).

推荐答案

vim (在文本或图形mode) 可以显示所有控制字符,如果你:set list.BOM 是一种特殊情况,由 :set bomb:set nobomb 命令控制.

vim (in either textual or graphic mode) can show all control characters if you :set list. The BOM is a special case, controlled by the :set bomb or :set nobomb commands.

这篇关于能够查看隐形的文本编辑器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆