I have an android app in Android Studio which was imported from eclipse. Beside the android module the project contains java modules.
The java modules handle charsets wrong, the android module does correct. I have this method implemented in an Activity and also in an sub-module class:
public String getUmlaute() {
return "öäüßÖÄÜ " + Charset.defaultCharset();
}
This
submoduleClass.getUmlaute() + "--" + getUmlaute();
returns
öäüßÖÄÜ java.nio.charset.CharsetICU[UTF-8] -- öäüßÖÄÜ java.nio.charset.CharsetICU[UTF-8]
All files are UTF-8 encoded of cause. Android Studio and also notepad++ confirm this and also the correctness of the letters.
Android Studio Settings
I tried both, clear the subproject default encoding and set it to UTF-8. No difference.
Whats going wrong here? Is there an encoding option missing?
Finally solved, but weired. I added
compileJava.options.encoding = 'UTF-8'
to every java build.gradle file.
I added
android {
compileOptions.encoding = "UTF-8"
to the android build.gradle file.
In "Settings"->File Encodings I set the Default Encoding of the Java Modules to windows-1252.
That did the trick. The files are still utf-8
Maybe its a windows file system problem. This is NTFS by the way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With