I’m using Eclipse on Mac OS X and I randomly get character \160 (whatever that is) instead of a whitespace in my code.
From time to time when I compile I get this error:
java:74: illegal character: \160
if (c == '*' ||?c == '/')
when my code in Eclipse actually looks like:
if (c == '*' || c == '/')
This is annoying and usually resolved by deleting the supposed invisible ? and pressing the space bar once again in the editor.
Why does this happen?
As Hanynowsky mentions, 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 remove the bogus mismatching characters, but you can actually see them in Eclipse if you enable the editor to show whitespaces.
For doing that: