Hi!
I'm trying to use launch4j to wrap my uber-jar. All in all it does it's job BUT it converts any cyrillic symbols in command line args to question marks when forwarding to jar. How to fix that?
1- When program is launched through launch4j-generated exe:
a) args received in main() routine (notice this additional backslash "\")
C:\temp\????????\file.txt.pgp
b) args discovered through WinAPI
C:\temp\????????\file.txt.pgp
2- When launch from command line using: java -jar pgpvaultgui-0.1.0.0.jar " C:\temp\Проверка\file.txt.pgp"
a) args received in main() routine (that additional backslash is stil lthere, looks like java bug)
C:\temp\????????\file.txt.pgp
b) args discovered through WinAPI
C:\temp\Проверка\file.txt.pgp
So it looks like encoding was lost between launch4j and java. Is it possible to configure it to work?
Couple links in case you want to look what exactly I do in the code:
- launch4j config currently used: https://github.com/skarpushin/pgpvault/blob/feature/pgpv-21/pgpvault-gui/launch4j.xml
- JNA way to get windows command line: https://github.com/skarpushin/pgpvault/blob/feature/pgpv-21/pgpvault-gui/src/main/java/org/pgpvault/gui/tools/osnative/OsNativeWindowsImpl.java#L53
- launch4j is used to wrap jar file as a part of maven build process: https://github.com/skarpushin/pgpvault/blob/feature/pgpv-21/pgpvault-gui/pom.xml#L201
p.s. changing Windows default codepage could be a temporary workaround, but not a solution. Other programs can handle cyrillic characeters without this change.
Any help is greately appreciated!
Thank you, Sergey
GK: It looks like the unicode CreateProcessW has to be used instead.
FWIW:
https://sourceforge.net/p/launch4j/discussion/332684/thread/587014cf/#75fc
Last edit: MuldeR 2020-09-26