Problem:
On an english Windows 10 using slovenian keyboard layout, all command line interfaces seem to have a problem with displaying (printing) UTF-8 characters, namely č, š and ž, which are replaced with ?. (I assume all UTF-8 specific characters, since ć and đ also do not work. )
Tested in:
Tried so far:
Sample code:
public class Test2 {
public static void main(String[] args) {
System.out.println("č š ž ć đ");
}
}
CMD:
>javac -encoding UTF-8 test2.java
>java Test2
? ? ? ? ?
Other notes:
Problem appears on several computers running on different hardware. All of the above mentioned characters work fine in all of the above mentioned CLI by default. So the problem only seems to appear with java.
Use chcp 65001 then run with java -Dfile.encoding=UTF-8 Test2:
chcp 65001
javac -encoding UTF-8 Test2.java
java -Dfile.encoding=UTF-8 Test2
Remember to name your Java source file after the class name, case-sensitive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With