Coirotomas
Coirotomas

Reputation: 15

Make Eclipse point me to encoding errors

I´m changing a Java project to use UTF-8 encoding. I made the change in preferences dialog in Eclipse, so that now I see lots of weird characters in code, strings and comments.

Is there any way to make Eclipse flag those characters as errors in a project?

Upvotes: 0

Views: 41

Answers (1)

Rüdiger Herrmann
Rüdiger Herrmann

Reputation: 20985

Eclipse cannot reliably point you to encoding errors.

Consider this character sequence for example

Rüdiger

which is clearly encoded in the wrong way. But without having a dictionary and knowing that this should actually be a German name, no machine can mark this an encoding error.

You need to convert all text files that are affected from the encoding change from the existing encoding to UTF-8.

Assuming that the existring encoding is ISO-8859-1 / Latin 1 you may use iconv like this:

iconv -f ISO-8859-1 -t UTF-8 myFile.xyz > myFile.utf8abc

Upvotes: 1

Related Questions