Eclipse:在文本编辑器中使用UTF-8编码使得Strings无法正常工作,我该如何解决? [英] Eclipse:Using UTF-8 encoding in the text editor make the Strings not work properly, how can I fix that?

查看:239
本文介绍了Eclipse:在文本编辑器中使用UTF-8编码使得Strings无法正常工作,我该如何解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在代码中有一些希腊语的意见,当我输入希腊字母时,它说保存我们的UTF-8



然后,如果我这样做,并重新运行以前显示的字符串的程序将无法正常工作。



例如,我正在使用加密算法(简化的Des),这是我用Cp1252编码在文本编辑器中输出:

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

第一行是加密版本,第二行是解密版本
这是我得到的我将编码更改为UTF-8

  O[ a[a j jt
NFO BOB 7 74

我不明白发生了什么在这里,我从来没有见过这样的事情。有人能帮我吗?谢谢你提前

解决方案

至少有一个关于应该以UTF-8格式保存源代码否。



我个人建议反对。我更希望使用 \uXXXX 符号来编码源代码中的希腊字符,并保持其他设置不变。


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

解决方案

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.

这篇关于Eclipse:在文本编辑器中使用UTF-8编码使得Strings无法正常工作,我该如何解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆