Change encoding in Eclipse

2019-04-22 19:22发布

I was working on my project in Windows using Eclipse (and I didn't check that my encoding was CP-1251). Now am going to work with my project in Linux with Eclipse too, but with UTF8 encoding, so all my comments are now non readable.

Can I just reconvert them into UTF using Eclipse?

2条回答
地球回转人心会变
2楼-- · 2019-04-22 19:51

There is a plugin for Eclipse "Autodetect Encoding" - you can detect/convert the encoding in files. It can be found in the Help->Marketplace...

I just started testing, but it works so far.

Hint: sometimes you need to change the detector to ICU4j

And even if the convert does not work in a current document (because of detection) you can do this: CTRL+C on one enconding switch to another and CTRL+V it will paste correct then save.

查看更多
来,给爷笑一个
3楼-- · 2019-04-22 19:53

You can set up the encoding used by eclipse in the Preferences section

Window -> Preferences -> General -> Workspace -> Text file encoding

You can also override it for a single project only if that is the only project you are having trouble with.

查看更多
登录 后发表回答