You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Dennis Lundberg (JIRA)" <ji...@apache.org> on 2019/02/12 13:36:00 UTC
[jira] [Comment Edited] (MRESOURCES-171) ISO8859-1 properties files
get changed into UTF-8 when filtered
[ https://issues.apache.org/jira/browse/MRESOURCES-171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16765910#comment-16765910 ]
Dennis Lundberg edited comment on MRESOURCES-171 at 2/12/19 1:35 PM:
---------------------------------------------------------------------
Hi,
We stumbled across this issue today for one of our projects that has {{project.build.sourceEncoding=UTF-8}} and includes properties files that use ISO-8859-1 encoding. The properties files are filtered. We have both regular properties files and properties files that are used as ResourceBundles. There are also non-properties files in the resources directory that needs to be filtered.
Here is a proposal on how such a situation can be handled.
{code:xml}
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>default-resources</id>
<goals>
<goal>resources</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/*.properties</exclude>
</excludes>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>resources-properties</id>
<goals>
<goal>resources</goal>
</goals>
<configuration>
<encoding>ISO-8859-1</encoding>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
{code}
was (Author: dennisl@apache.org):
Hi,
We stumbled across this issue today for one of our projects that has {{project.build.sourceEncoding=UTF-8}} and includes properties files that use ISO-8859-1 encoding. The properties files are filtered. We have both regular properties files and properties files that are used as ResourceBundles. There are also non-properties files in the resources directory that needs to be filtered.
Here is a proposal on how such a situation can be handled.
{code:xml}
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>resources-non-properties</id>
<goals>
<goal>resources</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/*.properties</exclude>
</excludes>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>resources-properties</id>
<goals>
<goal>resources</goal>
</goals>
<configuration>
<encoding>ISO-8859-1</encoding>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
{code}
> ISO8859-1 properties files get changed into UTF-8 when filtered
> ---------------------------------------------------------------
>
> Key: MRESOURCES-171
> URL: https://issues.apache.org/jira/browse/MRESOURCES-171
> Project: Maven Resources Plugin
> Issue Type: Bug
> Components: filtering
> Reporter: Alex Collins
> Priority: Minor
> Attachments: filtering-bug.zip
>
>
> Create:
> src/main/resources/test.properties
> And add a ISO8859-1 character that is not ASCII or UTF-8, do not use \uXXXX formatting.
> When adding this line:
> <resource><directory>src/main/resources</directory><filtering>true</filtering></resource>
> Expected:
> ISO8859-1 encoded file in jar.
> Actual:
> UTF-8 encoded file in jar.
> ---
> If there are any property files (which can only be ISO8859-1) they appear to be converted into UTF-8 in the jar.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)