Eclipse:Using UTF-8 encoding in the text editor make the Strings not work properly, how can I fix that?

风流意气都作罢 提交于 2019-12-02 21:13:52

问题


I have some Greek comments in the code and when I enter a Greek letter it says "Save us UTF-8"

Then if I do so and re run the program the previously displayed Strings would not work properly.

For example I'm working on an encryption algorithm(Simplified Des) and this is what I get with the Cp1252 encoding in the text editor as output:

ÅO [áa[aá»j×jt
INFO BOB 57674

the first line is the encrypted version and the second is the decrypted version this is what I get when I change the encoding to UTF-8

�O [�a[a�j�jt
���NFO���BOB���7���74

I don't understand what's going on here, I've never seen anything like this before. Can someone help me? Thank you in advance


回答1:


There's (at least) one discussion here on SO about Should source code be saved in UTF-8 format or not.

Personally, I'd advise against it. I'd much rather use the \uXXXX notation to encode those Greek characters in the source code and keep the other settings untouched.



来源:https://stackoverflow.com/questions/14167880/eclipseusing-utf-8-encoding-in-the-text-editor-make-the-strings-not-work-proper

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!