Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong resource file encoding when using proguard obfuscation option -adaptresourcefilecontents #371

Open
rolandas-karosas opened this issue Sep 23, 2024 · 3 comments

Comments

@rolandas-karosas
Copy link

after obfuscation resource file(s) become corrupted (UTF-8 encoding is lost)

OS name: "windows 11"
Java 8
Maven 3.9.7

plugin configuration:
proguard.conf

proguard.conf:
-dontshrink
-dontoptimize
-adaptresourcefilecontents META-INF/**.tld

All my resource files are correct with UTF-8 encoding.

Need to pass JVM argument -Dfile.encoding=UTF-8 to the forked java process. (same as passing maxMemory)

I checked directly executing proguard.jar. With argument -Dfile.encoding=UTF-8 resource files are good. Without argument -Dfile.encoding=UTF-8 I also get corrupted resource files.

P.S. other maven plugins (surefire plugin, failsafe plugin) have argLine argument for passing JVM options to the forked java process

@lasselindqvist
Copy link
Collaborator

Arguments are passed here https://github.com/wvengen/proguard-maven-plugin/blob/master/src/main/java/com/github/wvengen/maven/proguard/ProGuardMojo.java#L1037 It should be relatively easy to pass file.encoding on

@rolandas-karosas
Copy link
Author

Arguments are passed here https://github.com/wvengen/proguard-maven-plugin/blob/master/src/main/java/com/github/wvengen/maven/proguard/ProGuardMojo.java#L1037 It should be relatively easy to pass file.encoding on

These are main class arguments? Not the jvm args for java fork.
I get proguard.ParseException: Unknown option
https://github.com/Guardsquare/proguard/blob/master/base/src/main/java/proguard/ConfigurationParser.java#L169

@lasselindqvist
Copy link
Collaborator

Yes, you cannot pass it via that directly, but using https://ant.apache.org/manual/api/org/apache/tools/ant/taskdefs/Java.html#createJvmarg()

But it should be done in similar place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants