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

StackOverflow https://stackoverflow.com/questions/14167880

Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top