Konloch / bytecode-viewer

A Java 8+ Jar & Android APK Reverse Engineering Suite (Decompiler, Editor, Debugger & More)
https://bytecodeviewer.com
GNU General Public License v3.0
14.69k stars 1.15k forks source link

Non-UTF-8 Encoding Issue #419

Open zenner3000 opened 2 years ago

zenner3000 commented 2 years ago

Hi. This tool is super great !!! I found a BUG. non-English words like Chinese,Japanese...etc in the class file shows messy code. After I compile it using Kratau Bytecode editor, exported as zip or jar file . Then using JD-GUI or others check it out, that Non-English words in that compiled file, show you messy code. There are problems with the export process. Sorry for my English! Hope you can understand.

Konloch commented 2 years ago

Hi! Thank you for this report! I will look into this and see what solutions I can come up with. I'm thinking it's todo with non-ascii characters but I'm not sure exactly where in the process that would be failing

zenner3000 commented 2 years ago

Yes ,that's about non-ascii characters .

lovelyjuice commented 3 months ago

I tried to modify and compile a utf-8 encoding file contains Chinese character. Bytecode-viewer uses javac to compile it, but the default encoding of Windows is GBK when system region is Chinese, so the javac command failed to execute.

I don't know how to pass the arg -Dfile.encoding=UTF-8 to javac, but I found another solution, is that setting the value of the environment variable JAVA_TOOL_OPTIONS to -Dfile.encoding=UTF-8