You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2002/04/05 16:14:50 UTC
DO NOT REPLY [Bug 7765] New: -
replace task does not accept encoding
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7765>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7765
replace task does not accept encoding
Summary: replace task does not accept encoding
Product: Ant
Version: 1.4.1
Platform: All
OS/Version: Solaris
Status: NEW
Severity: Normal
Priority: Other
Component: Core tasks
AssignedTo: ant-dev@jakarta.apache.org
ReportedBy: sander@x-hive.com
The replace task does not take an encoding attribute. This is important, as now
replace will open the file in the system default encoding, and also write it
that way, which means character information may get lost.
We created a variation on your replace-task where you can specify an optional
encoding attribute. Code changed for this in Replace.java:
Introduced
private String encoding = null;
Setter
public void setEncoding(String encoding) {
this.encoding = encoding;
}
And changed opening of streams at line 294:
BufferedReader br;
BufferedWriter bw;
if (this.encoding == null) {
br = new BufferedReader(new FileReader(src));
bw = new BufferedWriter(new FileWriter(temp));
} else {
//System.out.println("Using encoding: " + this.encoding);
br = new BufferedReader(new InputStreamReader(new FileInputStream(src),
encoding));
bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(temp),
encoding));
}
No idea whether this also applies to other tasks.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>