when i compile java program using git bash, it displays non-latin symbols incorrectly, let me explain
i have something like this
class Test {
public static void main(String[] args) {
System.out.println("Тестим кириллицу в консоли");
}
}
and then, if i compile this code using git bash, i'll get this: -> https://i.stack.imgur.com/1aiza.png
I'm using UTF-8 encoding in git bash OS - Windows
In general, the point is that latin characters, namelly keywords are encoded by ASCII encoding standard which is supported by UTF-8 historically. However, the string in the println() method is encoded by windows-1251 encoding.
You can check it by yourself using
xxd filenamecommand in git bash, where 'filename' is your Class.java file. xxd (hexadecimal dump) is a command-line program that may be used to manage, convert, and display binary files on Unix and Unix-like operating systems.So, if you change the encoding to cp-1251 in git bash, characters will be displayed correctly.
I figured this out thanks to the comments to my question.