You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Julien HENRY (JIRA)" <ji...@codehaus.org> on 2011/07/22 15:01:43 UTC

[jira] Issue Comment Edited: (MASSEMBLY-561) Encoding is broken when filtering is enabled

    [ https://jira.codehaus.org/browse/MASSEMBLY-561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=273954#comment-273954 ] 

Julien HENRY edited comment on MASSEMBLY-561 at 7/22/11 8:00 AM:
-----------------------------------------------------------------

This patch adds 2 integration tests (filtering with 2 different encodings) to show the issue + the fix. We need 2 tests because if by chance your platform encoding match the expected encoding, the test will pass even without the fix. So if you don't apply the fix you should see at least one of the two ITs failing.
The fix consists of adding an "encoding" property to the assembly plugin like many other plugins (I took code from maven-resources-plugin). The encoding value is transmitted to the function that do the filtering. You can also set the project.build.sourceEncoding property in your pom. If no encoding is specified, a warning will be displayed and default platform encoding will be used.

      was (Author: henryju):
    This patch add 2 integration tests (filtering with 2 different encoding) to show the issue + the fix. We need 2 tests because if by chance your platform encoding match the expected encoding, the test will pass even without the patch. So if you don't apply the fix you should see one or two IT failures.
The fix is to add the encoding property to the assembly plugin like many other plugins (I took code from maven-resources-plugin). The encoding is transmitted to the function that do the filtering. You can also set the project.build.sourceEncoding property in your pom. If no encoding is specified, a warning will be displayed and default platform encoding will be used.
  
> Encoding is broken when filtering is enabled
> --------------------------------------------
>
>                 Key: MASSEMBLY-561
>                 URL: https://jira.codehaus.org/browse/MASSEMBLY-561
>             Project: Maven 2.x Assembly Plugin
>          Issue Type: Bug
>    Affects Versions: 2.2.1
>            Reporter: Julien HENRY
>            Priority: Critical
>         Attachments: MASSEMBLY-561.patch
>
>
> My resources are encoded in ISO-8859-1. I have specified encoding in the pom: 
> {code}<project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>{code}
> I have written a custom assembly file and I am using resource filtering.
> {code}...
> <fileSet>
> 	<directory>${project.basedir}/src/main/resources/</directory>
> 	<outputDirectory>/</outputDirectory>
> 	<filtered>true</filtered>
> </fileSet>
> ...{code}
> As a result all the french characters are broken in the resulting zip assembly. My platform is Linux so the default platform encoding is UTF-8.
> I have checked plugin code and I think I found the issue. This is in FileFormatter.java, method doFileFilter():
> {code}
>             configSource.getMavenFileFilter().copyFile( source, target, true, configSource.getProject(),
>                     configSource.getFilters(), isPropertiesFile, null, configSource.getMavenSession() );
> {code}
> You can see that enconding is set to null, so I think it means using default platform encoding... Would it be possible to use value of project.build.sourceEncoding instead?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira