I'm translating a Java application by using a ResourceBundle
with various *.properties
files. Now I like to have a Gradle task or want to modify a task to automatically escape any unicode character by replacing it with its ASCII representation, something like Java's native2ascii
tool does.
This is what I'm done so far with my build file, but the output remains unescaped:
import org.apache.tools.ant.filters.EscapeUnicode
tasks.withType(ProcessResources) {
filesMatching('**/*.properties') {
println "\t-> ${it}"
filter EscapeUnicode
}
}
Any help is appreciated.
You can do it providing the additional copy specification for properties files, this way:
import org.apache.tools.ant.filters.EscapeUnicode
tasks.withType(ProcessResources).each { task ->
task.from(task.getSource()) {
include '**/*.properties'
filter(EscapeUnicode)
}
}
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