Let's say there is this sample groovy code in my build.gradle
:
import org.apache.tools.ant.filters.ReplaceTokens
task doSomeFiltering(type: Copy) {
from 'some/directory'
into 'some/target'
filter(ReplaceTokens, tokens: [SAMPLE: '123abc456'])
}
If I had some Unicode characters in the copied and filtered files, they would be turned into the system default encoding in the output files, which creates some big problems if unicode-specific characters are used and the files are expected to stay in unicode.
So the problem is: This sample code does not respect custom encoding choices, it will always default to the system default for outputting the files after filtering. How can I set the encoding of the Reader/Writer that the filter uses?
Is it possible to work around this limitation, e.g. call Apache Ant directly?