DM_DEFAULT_ENCODING: Be explicit that we want the system default encoding.
[cfb.git] / prod / net / jaekl / cfb / CFB.java
index 33a1ca04b23312d3e19b05efbc8e8b5cfc2f1546..c088ca8d818aa3fa6574302e54129b275f51eb84 100644 (file)
@@ -9,7 +9,9 @@ package net.jaekl.cfb;
 
 import java.io.File;
 import java.io.IOException;
+import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
+import java.nio.charset.Charset;
 import java.sql.Connection;
 import java.sql.SQLException;
 import java.text.MessageFormat;
@@ -218,7 +220,9 @@ public class CFB {
                        Delta delta = new Delta(prior, analysis);
 
                        HtmlReport report = new HtmlReport(m_bundle, messageMap.getColl(), delta);
-                       report.write(m_output);
+                       if (null != m_output) {
+                               report.write(m_output);
+                       }
                        
                        Notifier notifier = new Notifier(m_bundle, m_config);
                        notifier.sendEmailIfNeeded(pw, report);
@@ -244,7 +248,7 @@ public class CFB {
        public static void main(String[] args) {
                CFB cfb = new CFB(Locale.getDefault());
                
-               try (PrintWriter pw = new PrintWriter(System.out)){
+               try (PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out, Charset.defaultCharset()))) {
                        cfb.doMain(pw, args);
                        pw.flush();
                } catch (SQLException | IOException | XmlParseException | SAXException | TypeMismatchException exc) {