Skip to content
Advertisement

Git Bash Terminal Encoding Issue with Java

Hi so I am on Win10 and Git 2.35.1.

JavaScript

I think my Git Bash terminal has some encoding issues. For example if I type java the message I got is all mojibake.

(I am not sure why my Java is printing in another language other than English honestly. I did not configure anything special when I install JRE or JDK.)

JavaScript

My locale is UTF-8 though:

JavaScript

And, when using commands like echo, UTF-8 characters are correctly displayed though:

JavaScript

I tried various methods like git config --global i18n.logOutputEncoding utf-8 and setx LC_ALL C.UTF-8 but java command still prints a mess.

What is the problem?

Is java command using some other encoding all together, not UTF-8?

Advertisement

Answer

Check first, as in here, if this works:

JavaScript

The second command would show the current settings.

If that work, you can set those options through the environment variable JAVA_TOOL_OPTIONS.
Although, since JDK9+, JDK_JAVA_OPTIONS is a valid alternative.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement