Java isn't able to recognize Unicode characters with the Beta: Use Unicode UTF-8 for worldwide language support
option enabled.
The path to my user folder is C:\Users\Otávio Augusto Silva
, and the á
character is causing some trouble for java.
By calling the javac
command if the JDK is installed inside my user folder using scoop install
, it gives the following result:
Erro: Não é possível carregar a classe principal com.sun.tools.javac.Main no módulo jdk.compiler
java.lang.UnsatisfiedLinkError: no jimage in system library path: C:\Users\Otávio Augusto Silva\scoop\apps\zulu-jdk\current\bin
Notice that it replaces the á
character with á
.
If installed globally by using scoop install -g
, choco install
or the default installer from any JDK distribution, the commands works fine, but if I call and pass the whole path, it gives an error:
C:\Users\Otávio Augusto Silva>javac "C:\Users\Otávio Augusto Silva\Documents\Code\Java\Hello World\main.java"
error: file not found: C:\Users\Otávio Augusto Silva\Documents\Code\Java\Hello World\main.java
Usage: javac <options> <source files>
use --help for a list of possible options
To reproduce, do the following:
- Have a user folder with a Unicode latin character (something like
á
,é
,ã
, etc.) - Have the
Beta: Use Unicode UTF-8 for worldwide language support
in region settings enabled - Install your favorite JDK distribution
- Call
javac
passing the whole path likeC:\Users\USERFOLER\PATH\TO\FILE\file.java
The error should appear.
I've been stuck for days in this, if anyone can help me it will be greatly appreciated.
Some relevant info:
- I'm using
cmd
in Windows Terminal app, butPowerShell
gives the same error - The
chcp
command gives the code65001
- I already tried the solution presented here, didn't work