3

I am trying to run Hebrew words by System.out.println - and i get question marks: ????

This issue prevent me to make if statement - check if string equals to something on Hebrew.

String one = "בוקר";
String two = "בוקר";
if (one.equals(two)) {
  System.out.println("בוקר");
}
//just for test the question marks:
System.out.println("בוקר");

I goes to Other settings -> Default settings -> Editor -> File Encodings -> Tried to put utf-8, and after this failed i tried to put windows-1255

Still, get question marks.

Oshrib
  • 1,789
  • 12
  • 40
  • 67
  • If you don't include any code or reproducible example this is gonna be tricky – Dici Sep 30 '15 at 17:59
  • @Dici i added to the question – Oshrib Sep 30 '15 at 18:01
  • Possible duplicate of [How do I compare strings in Java?](http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java) – Dici Sep 30 '15 at 18:02
  • @Dici - nop, also with equals - same results its return false. – Oshrib Sep 30 '15 at 18:04
  • 1
    This code works fine for me. And you're right, in this case even with `==` the string should be interned and it should return `true` – Dici Sep 30 '15 at 18:04
  • @Dici when you say "this code" you mean my code or the code from your link? thanks – Oshrib Sep 30 '15 at 18:05
  • 1
    Your code :) It worked for me using Eclipse. Gonna try with Intellij – Dici Sep 30 '15 at 18:08
  • 2
    You should change not just the default file encoding. You should change the IDE encoding. And everything has to be UTF-8. Here is a [useful explanation with screenshots](http://blog.jetbrains.com/idea/2013/03/use-the-utf-8-luke-file-encodings-in-intellij-idea/). – RealSkeptic Sep 30 '15 at 18:17

1 Answers1

0

add

-Dfile.encoding=UTF-8

when you start the program