Reputation: 367
I write some text with umlauts to gradle.properties and declare resValue in gradle.build. After build application in file gradleResValues.xml in builds folder, this variable contains uncorrect symbols.
I've tried to set encoding in compileOptions in gradle.build, getting String(variable.getBytes(), "UTF-8), but it's doesn't work.
APP_NAME = Begrüßungstext // in gradle.properties
resValue "string", "appName", APP_NAME //in gradle.build
<string name="appName" translatable="false">BegrüÃungstext</string> // in gradleResValues.xml
Upvotes: 2
Views: 1362
Reputation: 4753
Use character codes, like \u2321
.
In your case:
var appname = "Begr\u00fc\u00dfungstext"
fun main() {
println(appname) // output -> `Begrüßungstext`
}
In gradle it will work the same way, as it's runs on JVM.
Upvotes: 2
Reputation: 176
Try escaping characters with Unicode:
https://www.rapidtables.com/code/text/unicode-characters.html
ü -> \u00FC
ß -> \u00DF
Begrüßungstext -> Begr\u00FC\u00DFungstext
Upvotes: 1