2

I am writing a Java program with a GUI that will have Cyrillic text in some labels. When I create label JLabel lbl = new JLabel("Име на обект"); everything is fine and when my program starts it is also properly displayed. But I changed the PC I was working on and copied my project to my home PC. On that system, all Cyrillic text in my code now looks like JLabel lbl = new JLabel("РћС‚ Дата:*"); and is displayed in the same way when the program runs. How can I make Eclipse show my Cyrillic text normal again?

user3546762
  • 117
  • 1
  • 2
  • 6
  • 5
    Have you tried using [UTF-8 encoding in Eclipse](http://stackoverflow.com/questions/9180981/how-to-support-utf-8-in-eclipse) for your Java files? That should solve your encoding issues. – DaoWen Aug 18 '14 at 19:14
  • sorry i dint noticed it was a link – user3546762 Aug 18 '14 at 19:16
  • Tried it but it is still the same :( – user3546762 Aug 18 '14 at 19:23
  • The encoding is probably already corrupted, and switching to UTF-8 won't magically fix it. Just re-type the Cyrillic text _after_ ensuring you're using Unicode (UTF-8) encoding, and then it should (hopefully) stay properly encoded after that. – DaoWen Aug 18 '14 at 20:16

1 Answers1

1

i have the same issue :)

Delete the file. Copy the same file again. Don't open the file. Right Click on the file --> Properties. Resource --> Text file encoding --> check "Other" with UTF-8. Open the file.

Nikola Dimitrovski
  • 720
  • 1
  • 10
  • 23
  • In this case both the editor and the java compiler need to use the same encoding. That needs a bit more effort: workspace properties. The comments probably helped already. _Nevertheless useful for others._ – Joop Eggen Aug 19 '14 at 13:15