There is no other way of passing the information of what the file encoding is to Java AFAIK (unless there is a command line option you can add)
export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8
This resolved [a similar issue][0] for a Windows user, *mutatis mutandis*.
JDK toolchain binaries also accept `-Dfile.encoding` as [a command line switch][1].
[0]: https://github.com/geany/geany-plugins/issues/1262 [1]: https://docs.oracle.com/en/java/javase/20/intl/supported-encodings.html#GUID...