diff --git a/WHATSNEW b/WHATSNEW
index c318b6575..a29d48b28 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -46,7 +46,7 @@ Other changes:
--------------
* New tasks: antstructure, cab, execon, fail, ftp, genkey, jlink,
-junit, sql, javacc, jjtree, starteam, war, unwar, uptodate.
+junit, sql, javacc, jjtree, starteam, war, unwar, uptodate, native2ascii.
* New tasks mparse pending documentation.
diff --git a/docs/index.html b/docs/index.html
index d5cc00acc..1a343effa 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -4104,6 +4104,7 @@ it had been located at htdocs/manual/ChangeLog.txt
.
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 ++ +
+<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.
+ + \ No newline at end of file diff --git a/src/main/org/apache/tools/ant/taskdefs/defaults.properties b/src/main/org/apache/tools/ant/taskdefs/defaults.properties index f4804c0db..4d0110a36 100644 --- a/src/main/org/apache/tools/ant/taskdefs/defaults.properties +++ b/src/main/org/apache/tools/ant/taskdefs/defaults.properties @@ -32,7 +32,6 @@ filter=org.apache.tools.ant.taskdefs.Filter fixcrlf=org.apache.tools.ant.taskdefs.FixCRLF rename=org.apache.tools.ant.taskdefs.Rename patch=org.apache.tools.ant.taskdefs.Patch -compileTask=org.apache.tools.ant.taskdefs.CompileTask style=org.apache.tools.ant.taskdefs.XSLTProcess touch=org.apache.tools.ant.taskdefs.Touch signjar=org.apache.tools.ant.taskdefs.SignJar @@ -64,6 +63,8 @@ javacc=org.apache.tools.ant.taskdefs.optional.javacc.JavaCC jjtree=org.apache.tools.ant.taskdefs.optional.javacc.JJTree starteam=org.apache.tools.ant.taskdefs.optional.scm.AntStarTeamCheckOut jlink=org.apache.tools.ant.taskdefs.optional.jlink.JlinkTask +native2ascii=org.apache.tools.ant.taskdefs.optional.Native2Ascii # deprecated ant tasks (kept for back compatibility) javadoc2=org.apache.tools.ant.taskdefs.Javadoc +compileTask=org.apache.tools.ant.taskdefs.CompileTask diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java b/src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java new file mode 100644 index 000000000..dd180fc9c --- /dev/null +++ b/src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java @@ -0,0 +1,231 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2000 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + *