How to specify character encoding for Ant Task parameters in Java
Posted
by räph
on Stack Overflow
See other posts from Stack Overflow
or by räph
Published on 2010-06-14T12:16:12Z
Indexed on
2010/06/14
12:32 UTC
Read the original article
Hit count: 321
I'm writing an ANT task in Java.
In my build.xml I specify parameters, which should be read from my java class. Problems occur, when I use special characters, like german umlauts (Ö,Ä,Ü) in these parameters. In my java task they appear as ?-characters (using System.out.print).
All my files are encoded as UTF-8. and my build.xml has the corresponding declaration:
<?xml version="1.0" encoding="UTF-8" ?>
For the details of writing the task: I do it according to http://ant.apache.org/manual/develop.html (especially Point 5 nested elements). I have nested elements in my task like:
<parameter name="test" value="ÖÄÜtest"/>
and a java method:
public void addConfiguredParameter(Parameter prop) {
System.out.println(prop.getValue());
//prints ???test
}
to read the parameter values.
© Stack Overflow or respective owner