How to use ant task - native2ascii
I'm trying to convert a .txt file which contains accented characters to their equivalent java unicode value. So í is converted to \u00ED .
The filename is called conversion.txt Below is how I am trying to use the ant 开发者_运维知识库target -
<target name="EncodeFile" >
<native2ascii encoding="ISO8859_1" src="C:\Projects\encodingfiles"
dest="C:\Projects\encodingfiles"
includes="C:\Projects\encodingfiles" ext=".txt" />
</target>
The ant target runs without error but no conversion takes place.
Thanks for any help
You've specified a directory for includes
, from the native2ascii
task docs:
includes comma- or space-separated list of patterns of files that must be included. All files are included when omitted.
You need to specify a pattern for the files, or an exact name for the file you want to convert. See Directory-based Tasks for the full story.
Another thing to watch out for is if your src
and dest
are the same, and you want to convert .txt
files, specifying ext=".txt"
will not work. This is because Ant will determine that, as the source and destination file name are the same, the file is up-to-date with respect to itself as it were, and skip it.
If you need to overwrite the original files, use an alternate dest
and then copy the converted files back to src
to overwrite.
(Often running
ant -verbose
can help to give you more of an idea why Ant has done nothing.)
精彩评论