Github user matthiasblaesing commented on the issue:
https://github.com/apache/incubator-netbeans/pull/70
I think the problem is in rat - with an output file this is what happens:
1. the Report Task creates an FileWriter that writes to the target file and
wraps a PrintWriter to it ([Report
Task](http://svn.apache.org/repos/asf/creadur/rat/trunk/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Report.java),
line 196)
2. this PrintWriter is passed to the core Report report method, where an
XmlWriter is created ([Report
Task](http://svn.apache.org/repos/asf/creadur/rat/trunk/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Report.java),
line 268, [Report
Class](http://svn.apache.org/repos/asf/creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/Report.java),
line 411)
3. The XML prolog is written in
`org.apache.rat.report.xml.writer.impl.base.XmlWriter#startDocument`
[XmlWriter](http://svn.apache.org/repos/asf/creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/report/xml/writer/impl/base/XmlWriter.java)
```java
if (reportFile == null) {
out = new PrintWriter(
new OutputStreamWriter(
new LogOutputStream(this, Project.MSG_INFO)
)
);
} else {
out = new PrintWriter(new FileWriter(reportFile));
}
createReport(o
```
The prolog written in step 3 would be wrong in many cases as it does not
write an encoding info. This means the encoding of the resulting document must
be UTF-8. The FileWriter created in step 1 uses the default charset and if that
is not UTF-8 a broken stream will result.
The Report Task would need to be changed from (line 196):
```java
out = new PrintWriter(new FileWriter(reportFile));
```
to
```java
out = new PrintWriter(new OutputStreamWriter(new
FileOutputStream(reportFile), Charset.forName("UTF-8")));
```
---