You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by "Andrew B. Sudell" <as...@acm.org> on 2000/09/20 05:15:17 UTC

native2ascii task

I've written the attached native2ascii task, which I'd like to submit
for inclusion with ant.  It essentially serves as a wrapper for the
jdk native2ascii, with some additional smarts to act as a MatchingTask
and do dependency checking.  A draft usage is below.  Thanks to
Hiroaki Nakamura <hn...@mc.neweb.ne.jp>, for useful comments on
how the task ought work (and prodding me to make it a bit more useful
than I'd originally planed).

Native2Ascii

Description:

Converts files from native encodings to ascii with escaped Unicode.
A common usage is to convert source files maintained in a native
operating system encoding, to ascii prior to compilation.

All matching files in the source directory are converted from a
native encoding to ascii.  If no encoding is specified, the default
encoding for the JVM is used.  If ext is specified, then output
files are renamed to use it as a new extension.  If dest and
src point to the same directory, ext is required.

This is a directory based task, and supports includes, includesfile,
excludes, excludesfile, and defaultexcludes along with its specific
attributes.

Attribute Description                              Required
-----------------------------------------------------------
reverse   Reverse the sense of the conversion,     No
          i.e. convert from ascii to native 

encoding  The native encoding the files are in     No

src       The directory to find files in           No

dest      The directory to output file to          Yes

ext       File extension to use in renaming        No
          output files 


Examples

<native2ascii encoding="EUCJIS" src="srcdir" dest="srcdir"
   includes="**/*.eucjis" ext=".java" />

Converts all files in the directory srcdir ending in eucjis
from the EUCJIS encoding to ascii and renames the to end in
.java.

<native2ascii encoding='EUCJIS" src="native/japanese" dest="src"
   includes="**/*.java />

Converts all the files ending in .java in the directory native/japanese
to ascii, placing the results in the directory src.  The names of
the files remain the same.