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

bug: invalid smali strings on OS where UTF-8 is not default encoding. #330

Closed
3 tasks done
Tahgolov opened this issue Jan 5, 2025 · 3 comments · Fixed by #331 · May be fixed by #326
Closed
3 tasks done

bug: invalid smali strings on OS where UTF-8 is not default encoding. #330

Tahgolov opened this issue Jan 5, 2025 · 3 comments · Fixed by #331 · May be fixed by #326
Labels
Bug report Something isn't working

Comments

@Tahgolov
Copy link
Contributor

Tahgolov commented Jan 5, 2025

Bug description

When I wanna use const-string instructions with strings such as :§l§a#3 or contained characters from another languages it's compiled as invalid.
Here, you can see comparation between Linux(valid)/Windows(invalid):
Image

Solution

I think this bug related wtih Locale.ENGLISH used in the InlineSmaliCompiler

Acknowledgements

  • I have checked all open and closed bug reports and this is not a duplicate.
  • I have chosen an appropriate title.
  • All requested information has been provided properly.
@Tahgolov Tahgolov added the Bug report Something isn't working label Jan 5, 2025
@LisoUseInAIKyrios
Copy link
Contributor

LisoUseInAIKyrios commented Jan 5, 2025

Locale.ENGLISH controls the string formatting and I don't think it causes issues with using non English strings.

The string format should be English because using the device language with some foreign languages can cause numbers to format to letters, such as Arabic that will change "123" into "۱۲۳". Or many other languages that use commas instead of decimals.

Maybe it's an issue with strings not loading as UTF8.

Try changing the source file your using to UTF8 encoding, and see if that fixes it.

@Tahgolov
Copy link
Contributor Author

Tahgolov commented Jan 5, 2025

@LisoUseInAIKyrios
I tried, it doesn't help

@Tahgolov
Copy link
Contributor Author

Tahgolov commented Jan 5, 2025

@LisoUseInAIKyrios
You were right. It's not Locale.ENGLISH. This is caused by InputStreamReader, which uses Charset.forDefault in one of its constructors. So the bug occurs on OSes that do not use UTF-8 by default. I quickly made a manual fix by editing the bytecode to test it out...

@Tahgolov Tahgolov changed the title bug: invalid strings after smali code compilation. bug: invalid strings after smali code compilation on OS where UTF-8 is not default encoding. Jan 5, 2025
@Tahgolov Tahgolov changed the title bug: invalid strings after smali code compilation on OS where UTF-8 is not default encoding. bug: invalid smali strings on OS where UTF-8 is not default encoding. Jan 5, 2025
Tahgolov added a commit to Tahgolov/revanced-patcher that referenced this issue Jan 5, 2025
@Tahgolov Tahgolov closed this as completed Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug report Something isn't working
Projects
None yet
2 participants