diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 7e9346fad..a78940d1d 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -254,6 +254,7 @@ Michael Saunders
Miha
Mike Davis
Mike Roberts
+Miroslav Zaťko
mnowostawski
Mounir El Hajj
Nathan Beyer
diff --git a/WHATSNEW b/WHATSNEW
index c41ace5dc..dcc72fd75 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -88,6 +88,9 @@ Other changes:
* now has an option to fail if javadoc issues warnings.
Bugzilla Report 55015
+ * has a new outputencoding attribute.
+ Bugzilla Report 39541
+
Changes from Ant 1.9.2 TO Ant 1.9.3
===================================
diff --git a/contributors.xml b/contributors.xml
index ea1dece85..f37dc7af9 100644
--- a/contributors.xml
+++ b/contributors.xml
@@ -1037,6 +1037,10 @@
Mike
Roberts
+
+ Miroslav
+ Zaťko
+
mnowostawski
diff --git a/manual/Tasks/sql.html b/manual/Tasks/sql.html
index 84dc1279d..e5f4db837 100644
--- a/manual/Tasks/sql.html
+++ b/manual/Tasks/sql.html
@@ -90,6 +90,12 @@ and abort execution and transaction and fail task.
The encoding of the files containing SQL statements |
No - defaults to default JVM encoding |
+
+ outputencoding |
+ The encoding of the files holding
+ results. since 1.9.4
+ | No - defaults to default JVM encoding |
+
delimiter |
String that separates SQL statements |
diff --git a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
index 576ececc7..f1c75c4d2 100644
--- a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
+++ b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
@@ -162,6 +162,11 @@ public class SQLExec extends JDBCTask {
*/
private Resource output = null;
+ /**
+ * Output encoding.
+ */
+ private String outputEncoding = null;
+
/**
* Action to perform if an error is found
*/
@@ -428,6 +433,17 @@ public class SQLExec extends JDBCTask {
this.output = output;
}
+ /**
+ * The encoding to use when writing the result to a resource.
+ * Default's to the platform's default encoding
+ * @param outputEncoding the name of the encoding or null for the
+ * platform's default encoding
+ * @since Ant 1.9.4
+ */
+ public void setOutputEncoding(String outputEncoding) {
+ this.outputEncoding = outputEncoding;
+ }
+
/**
* whether output should be appended to or overwrite
* an existing file. Defaults to false.
@@ -641,7 +657,12 @@ public class SQLExec extends JDBCTask {
}
}
}
+ if (outputEncoding != null) {
+ out = new PrintStream(new BufferedOutputStream(os),
+ false, outputEncoding);
+ } else {
out = new PrintStream(new BufferedOutputStream(os));
+ }
}
// Process all transactions