Hi, this is my first post to ant-dev.

Attached is a patch for adding -encoding option support for Javac task.

This change is needed when you compile a Java source file whose encoding
is different from the OS native encoding, for example, the file encoding
is SJIS and the OS encoding is EUCJIS.  This is a usual case when you
develop on multi OSes like Solaris and Windows.

I hope this patch is useful and will be included soon.
Thank you.

-- 
)Hiroaki Nakamura) [EMAIL PROTECTED]
--- Javac.java.orig     Fri Jul 14 15:09:22 2000
+++ Javac.java  Sat Aug 26 19:04:20 2000
@@ -72,6 +72,7 @@
  * <li>extdirs
  * <li>optimize
  * <li>debug
+ * <li>encoding
  * <li>target
  * </ul>
  * Of these arguments, the <b>sourcedir</b> and <b>destdir</b> are required.
@@ -97,6 +98,7 @@
     private Path src;
     private File destDir;
     private Path compileClasspath;
+    private String encoding;
     private boolean debug = false;
     private boolean optimize = false;
     private boolean deprecation = false;
@@ -213,6 +215,13 @@
     }
 
     /**
+     * Set the Java source file encoding name.
+     */
+    public void setEncoding(String encoding) {
+        this.encoding = encoding;
+    }
+
+    /**
      * Set the debug flag.
      */
     public void setDebug(boolean debug) {
@@ -478,6 +487,10 @@
                 argList.addElement(target);
             }
         }
+        if (encoding != null) {
+            argList.addElement("-encoding");
+            argList.addElement(encoding);
+        }
         if (debug) {
             argList.addElement("-g");
         }
@@ -560,6 +573,10 @@
             argList.addElement("-target");
             argList.addElement(target);
         }
+        if (encoding != null) {
+            argList.addElement("-encoding");
+            argList.addElement(encoding);
+        }
         if (debug) {
             argList.addElement("-g");
         }
@@ -672,6 +689,10 @@
         argList.addElement("-classpath");
         argList.addElement(classpath.toString());
 
+        if (encoding != null) {
+            argList.addElement("-encoding");
+            argList.addElement(encoding);
+        }
         if (debug) {
             argList.addElement("-g");
         }
--- index.html.orig     Tue Jul 18 07:50:22 2000
+++ index.html  Sat Aug 26 19:03:58 2000
@@ -1757,6 +1757,11 @@
     <td align="center" valign="top">No</td>
   </tr>
   <tr>
+    <td valign="top">encoding</td>
+    <td valign="top">encoding of source files.</td>
+    <td align="center" valign="top">No</td>
+  </tr>
+  <tr>
     <td valign="top">debug</td>
     <td valign="top">indicates whether there should be compiled with debug
       information (&quot;on&quot;).</td>

Reply via email to