在Mac OSX上使用eclipse,我得到了随机的不可见字符\160。为什么? [英] Using eclipse on Mac OSX, I get random invisible character \160 . Why?
问题描述
我在Mac OSX上使用Eclipse,我随机得到了字符\160(无论是什么字符),而不是代码中的空格。
I'm using Eclipse on Mac OSX and I randomly get character \160 (whatever that is) instead of a whitespace in my code.
编译时出现以下错误:
java:74: illegal character: \160
if (c == '*' ||?c == '/')
当我Eclipse中的代码实际上看起来像这样:
when my code in Eclipse actually looks like:
if(c =='*'|| c =='/')
这很烦人,通常可以通过删除所谓的不可见来解决?然后在编辑器中再次按空格键。
This is annoying and usually resolved by deleting the supposed invisible ? and pressing spacebar once again in the editor.
我很好奇如果有人有想法为什么会发生这种情况。
I'm curious as to why this happens if anybody has an idea.
推荐答案
就像@Hanynowsky提到的,它与复制的源和文件中的编码不同。我还没有找到自动删除虚假不匹配字符的任何方法,但是如果使编辑器显示空白,您实际上可以在eclipse中看到它们。
as @Hanynowsky mention it is related to a different encoding between the source you copied and the one from your file. I have not found any way to automatically removed the bogus mismatching characters, but you can actually see them in eclipse if you enable the editor to show whitespaces.
为此:
- 将Eclipse设置为显示空白字符(首选项->常规->编辑器->文本编辑器下的选项)
- 虚假的\160字符将显示为。即使您的其他空格将显示为。。因此,您只需要删除。发生并且您很好!
这篇关于在Mac OSX上使用eclipse,我得到了随机的不可见字符\160。为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!