You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Aaron Digulla (JIRA)" <ji...@codehaus.org> on 2014/04/16 17:36:10 UTC
[jira] (MRESOURCES-171) ISO8859-1 properties files get changed into
UTF-8 when filtered
[ https://jira.codehaus.org/browse/MRESOURCES-171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=345029#comment-345029 ]
Aaron Digulla commented on MRESOURCES-171:
------------------------------------------
I just stumbled over the same issue.
Background: Property files need to use ISO-8859-1 as encoding as per [the docs|http://docs.oracle.com/javase/7/docs/api/java/util/Properties.html]:
{quote}
except the input/output stream is encoded in ISO 8859-1 character encoding
{quote}
Note: This is only true for the simple line-oriented properties file format, not the XML version!
This becomes a problem when the default encoding {{project.build.sourceEncoding}} is set to something else because the resource plugin will try to load the files with this encoding (ignoring the Java standard) which garbles the input when it contains non-ASCII characters like "öäü".
IDE usually get this right by ignoring the project's defaults for these files and enforcing ISO-8859-1 for {{*.properties}} files.
I see two solutions:
# Configure the resource plugin to ignore those files (which is bad since then, we can't replace variables in them anymore)
# Offer a per-file-type encoding
That way, one could say:
{code}
<configuration>
<filetypes>
<filetype>
<encoding>iso-8859-1</encoding>
<pattern>*.properties</pattern>
</filetype>
</filetypes>
</configuration>
{code}
I'd even opt for this to be the default.
> ISO8859-1 properties files get changed into UTF-8 when filtered
> ---------------------------------------------------------------
>
> Key: MRESOURCES-171
> URL: https://jira.codehaus.org/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
(v6.1.6#6162)