[RESOURCES-171] ISO8859-1 properties files get changed into UTF-8 when filtered.
- Added an optional separate configuration parameter to set the encoding of filtered properties files
diff --git a/pom.xml b/pom.xml
index c72b567..e4411ac 100644
--- a/pom.xml
+++ b/pom.xml
@@ -69,7 +69,7 @@
   </distributionManagement>
 
   <properties>
-    <mavenFilteringVersion>3.1.2-SNAPSHOT</mavenFilteringVersion>
+    <mavenFilteringVersion>3.2.0-SNAPSHOT</mavenFilteringVersion>
     <mavenVersion>3.0</mavenVersion>
     <javaVersion>7</javaVersion>
     <project.build.outputTimestamp>2020-04-07T21:04:00Z</project.build.outputTimestamp>
diff --git a/src/it/MRESOURCES-171/pom.xml b/src/it/MRESOURCES-171/pom.xml
new file mode 100644
index 0000000..e9ad721
--- /dev/null
+++ b/src/it/MRESOURCES-171/pom.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.plugins.maven-resources-plugin.its</groupId>
+  <artifactId>MRESOURCES-171</artifactId>
+  <name>Bug Test</name>
+  <version>0.0.1-SNAPSHOT</version>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>true</filtering>
+      </resource>
+    </resources>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>@project.version@</version>
+        <configuration>
+          <propertiesEncoding>ISO-8859-1</propertiesEncoding>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/src/it/MRESOURCES-171/src/main/resources/test.properties b/src/it/MRESOURCES-171/src/main/resources/test.properties
new file mode 100644
index 0000000..7cc2b46
--- /dev/null
+++ b/src/it/MRESOURCES-171/src/main/resources/test.properties
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+actual=No hay conexión
+expected=No hay conexi\u00f3n
diff --git a/src/it/MRESOURCES-171/src/main/resources/test.txt b/src/it/MRESOURCES-171/src/main/resources/test.txt
new file mode 100644
index 0000000..281e65c
--- /dev/null
+++ b/src/it/MRESOURCES-171/src/main/resources/test.txt
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+Some text encoded in UTF-8 containing non-ascii characters conexión.
diff --git a/src/it/MRESOURCES-171/verify.groovy b/src/it/MRESOURCES-171/verify.groovy
new file mode 100644
index 0000000..e900c73
--- /dev/null
+++ b/src/it/MRESOURCES-171/verify.groovy
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+assert new File( basedir, 'target/classes/test.properties' ).exists();
+assert new File( basedir, 'target/classes/test.txt' ).exists();
+
+sourceTextContent = new File( basedir, 'src/main/resources/test.txt' ).text;
+targetTextContent = new File( basedir, 'target/classes/test.txt' ).text;
+assert sourceTextContent.equals( targetTextContent );
+return true;
diff --git a/src/main/java/org/apache/maven/plugins/resources/ResourcesMojo.java b/src/main/java/org/apache/maven/plugins/resources/ResourcesMojo.java
index 9fed534..1105965 100644
--- a/src/main/java/org/apache/maven/plugins/resources/ResourcesMojo.java
+++ b/src/main/java/org/apache/maven/plugins/resources/ResourcesMojo.java
@@ -70,6 +70,13 @@
     protected String encoding;
 
     /**
+     * The character encoding to use when reading and writing filtered properties files.
+     * If not specified, it will default to the value of the "encoding" parameter.
+     */
+    @Parameter
+    protected String propertiesEncoding;
+
+    /**
      * The output directory into which to copy the resources.
      */
     @Parameter( defaultValue = "${project.build.outputDirectory}", required = true )
@@ -338,6 +345,9 @@
             // if these are NOT set, just use the defaults, which are '${*}' and '@'.
             mavenResourcesExecution.setDelimiters( delimiters, useDefaultDelimiters );
 
+            // Handle MRESOURCES-171
+            mavenResourcesExecution.setPropertiesEncoding( propertiesEncoding );
+
             if ( nonFilteredFileExtensions != null )
             {
                 mavenResourcesExecution.setNonFilteredFileExtensions( nonFilteredFileExtensions );