Hello,

The bug database appears to be down.  The bug I wanted to submit was against
ANT.  If you use the <copy> task with filtering turned on, and the file is a
different encoding type than the default decoding, the copy task will mangle
the destination file.

For example, I am using a Windows 2000 workstation with JDK 1.4 installed.
I am putting together a Japanese and English website, where the files are
all in UTF-8 format.  The default encoding (as seen with the following code:

import java.io.*;

...
FileReader reader = new FileReader("some file");
System.out.println (reader.getEncoding());
...

will be CP1252 (US-ASCII).  What the copy task needs is an additional
IMPLIED attribute that specifies the encoding for filtering tasks.  The code
in the org.apache.tools.ant.util.FileUtils class would need to be changed so
it could receive an encoding parameter as well.  Lines 220, 221 of
FileUtils.java would need to be replaced with:

FileInputStream fis = new FileInputStream (sourceFile);
FileOutputStream fos = new FileOutputStream (destFile);
InputStreamReader in = new InputStreamReader (fis, encoding);
OutputStreamWriter out = new OutputStreamWriter (fos, encoding);

This would fix the encoding problems with the filtering, as long as all
content encountered during the filtering process was UTF8 encoded (since
ASCII is subsumed by UTF8, this shouldn't be a problem for most people).

Thanks, and I will post a patch on the jakarta-ant mailing list.

-Chris


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to