如何找出文本输入或文件中的确切字符?

How do I find out exact characters in a text input or file?

我想找出文本文件中的确切字符。我从 Whosebug 复制并粘贴了一些代码,看似完美的代码导致了语法错误。当我自己写完全相同的东西时,它起作用了。然后我 运行 通过 diff 截取了两个片段,它表明存在差异,但差异出现在两个完全空白的字符中。我真的很想知道它们是什么。

它在 Whosebug 上的代码块中不可见,但空格和制表符的数量也完全相同,至少从 Sublime Text 和 nano 的解释来看是这样。

这是我将片段与 diff:

进行比较时的输出
me@local /tmp $ cat a
$('.dropdown-layers').click(function(event){
        debug('here');
        event.stopPropagation();
    });​
me@local /tmp $ cat b
$('.dropdown-layers').click(function(event){
        debug('here');
        event.stopPropagation();
    });
me@local /tmp $ diff a b
4c4
<   });​
---
>   });

尝试

diff a b | od -tx1

或一些变体