[ 
https://issues.apache.org/jira/browse/MRESOURCES-171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17158617#comment-17158617
 ] 

Dennis Lundberg commented on MRESOURCES-171:
--------------------------------------------

Great feedback guys! We are really getting closer to the best possible solution 
to a rather complicated situation.

As [~afloom] points out the default for encoding ResourceBundles changed in 
Java 9 to UTF-8. But the Properties class still uses ISO-8859-1 when reading or 
writing properties files.
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Properties.html
This means that we cannot base the plugin behavior on which version of java is 
being used, because it depends... Properties files for ResourceBundle should 
have one encoding and regular properties files should have another. No way we 
can automate the guesswork for that.

I feel that [~digulla]s second approach is the best solution we can find, given 
the complexities at hand. I will go ahead with my original intent to add a new 
property called propertiesEncoding. If it is not set I will add a suitable 
WARNING in the log that it will be defaulting to whatever the encoding 
parameter is set to, because we want to be backwards compatible. I'll also link 
to a new page in the plugin site where I will try to describe the different 
scenarios possible when it comes to encoding and properties files, and how to 
configure the plugin properly.

> 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
(v8.3.4#803005)

Reply via email to