You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Mauro Talevi <ma...@aquilonia.org> on 2008/08/30 15:59:39 UTC
Encoding issues with images using dependency and resource plugins?
Hi all,
I've hit upon what I think are encoding issues with the dependency
and/or resource plugin, and I'd like to sound out what the others' take
on it is.
So imagine a scenario in which one has a module that encapsulates all
web resources (images, css, js, etc ...) which is shared amongst several
webapps. These resources can be packaged in a jar and unpacked via the
dependency plugin in the webapp modules.
The problem that occurs is that building on different platforms (say Mac
for dev and Linux for deployment) the image resources get corrupted (and
cannot be retrieve via the web browser from the deployed webapp).
The reason why I think it's encoding-related is that:
1. Copying the war built on dev machine to server works fine
2. Adopting the workaround of overriding the image resources with the
ones copied from filesystem via ant task (ie by-passing both the
dependency and resource plugins) also works fine when built on the server.
I've tried setting UTF-8 encoding on resources plugin, but that makes
the images unreadable on Mac.
I note in passing that the dependency plugin uses the Plexus Unarchiver
to unpack, but only the ZipUnarchiver allows to set the encoding
property. Is there any reason why setEncoding() is not pulled up to
Unarchiver interface?
Summing up, anybody else experienced similar issues?
Thanks
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Encoding issues with images using dependency and resource plugins?
Posted by Mauro Talevi <ma...@aquilonia.org>.
Benjamin Bentmann wrote:
> What encoding exactly would you like to set? The encoding of the file
> contents? This is not necessary. Encoding is only required when one has
> to convert between bytes and characters but the (un-)archiving of files
> is merely a byte-to-byte copy, i.e. operates on a lower level and does
> not involve textual interpretation of the file contents:
>
> Characters --filter--> Characters Semantic Layer
> ^ |
> | |
> decode encode
> | |
> | v
> Bytes ---copy---> Bytes Physical Layer
>
> IIRC, the Dependency Plugin doesn't do filtering so should be fine
> without encoding configuration.
>
Hi Benjamin,
yes you're right - my brain was having a tea break :-)
so, yep, all works fine if I don't filter binary images.
Cheers
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Encoding issues with images using dependency and resource plugins?
Posted by Rémy Sanlaville <re...@gmail.com>.
Hi,
I don't know if it can help but in case...
Did you see this thread ?
http://www.nabble.com/damage-image-files-td15431864.html#a15432280
Rémy
Re: Encoding issues with images using dependency and resource plugins?
Posted by Benjamin Bentmann <be...@udo.edu>.
Mauro Talevi wrote:
>> ZipUnarchiver.setEncoding() only controls the encoding for file names
>> as given by zip entries [1,2], not the encoding of the compressed file
>> contents [3]. So unless you experience corrupt file names, that
>> shouldn't be the cause of your problem.
>
> Ok - understood, but shouldn't the copying done via the unarchiver in
> the dependency plugin be able to set the encoding like the resource plugin?
What encoding exactly would you like to set? The encoding of the file
contents? This is not necessary. Encoding is only required when one has
to convert between bytes and characters but the (un-)archiving of files
is merely a byte-to-byte copy, i.e. operates on a lower level and does
not involve textual interpretation of the file contents:
Characters --filter--> Characters Semantic Layer
^ |
| |
decode encode
| |
| v
Bytes ---copy---> Bytes Physical Layer
IIRC, the Dependency Plugin doesn't do filtering so should be fine
without encoding configuration.
Benjamin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Encoding issues with images using dependency and resource plugins?
Posted by Mauro Talevi <ma...@aquilonia.org>.
Benjamin Bentmann wrote:
> Do you filter the images? AFAIK, the Resources Plugin should not alter a
> file's contents during copying unless <filtering> is enabled on the
> <resource> set.
Yep - that is indeed the case, I do filter and that is most likely the
root of the issue.
> If you filter your web stuff, you will need to exclude the images (and
> any other files with binary content) from the filtering. I.e. define two
> mutually exclusive <resource> sets, one for the text files to be
> filtered and one for the binary stuff to be just copied over unaltered.
Will do. Thanks for the heads up.
> Ant's <copy> task also has a warning about filtering binary data [0].
And infact, I was not filtering when I copied with ant because they were
just images.
> ZipUnarchiver.setEncoding() only controls the encoding for file names as
> given by zip entries [1,2], not the encoding of the compressed file
> contents [3]. So unless you experience corrupt file names, that
> shouldn't be the cause of your problem.
Ok - understood, but shouldn't the copying done via the unarchiver in
the dependency plugin be able to set the encoding like the resource plugin?
Cheers
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Encoding issues with images using dependency and resource plugins?
Posted by Stephen Connolly <st...@gmail.com>.
what I normally do is alter the standard directory layout
I have two folder trees for resources
src/main/resources/filtered
and
src/main/resources/verbatim
for web projects I usually end up with
src/main/webapp
and
src/filtered/webapp
Sent from my iPod
On 30 Aug 2008, at 15:42, Benjamin Bentmann
<be...@udo.edu> wrote:
> Mauro Talevi wrote:
>
>> I've tried setting UTF-8 encoding on resources plugin, but that
>> makes the images unreadable on Mac.
>
> Do you filter the images? AFAIK, the Resources Plugin should not
> alter a file's contents during copying unless <filtering> is enabled
> on the <resource> set.
>
> If you filter your web stuff, you will need to exclude the images
> (and any other files with binary content) from the filtering. I.e.
> define two mutually exclusive <resource> sets, one for the text
> files to be filtered and one for the binary stuff to be just copied
> over unaltered.
>
> Ant's <copy> task also has a warning about filtering binary data [0].
>
>> I note in passing that the dependency plugin uses the Plexus
>> Unarchiver to unpack, but only the ZipUnarchiver allows to set the
>> encoding property. Is there any reason why setEncoding() is not
>> pulled up to Unarchiver interface?
>
> ZipUnarchiver.setEncoding() only controls the encoding for file
> names as given by zip entries [1,2], not the encoding of the
> compressed file contents [3]. So unless you experience corrupt file
> names, that shouldn't be the cause of your problem.
>
>
> Benjamin
>
>
> [0] http://ant.apache.org/manual/CoreTasks/copy.html#encoding
> [1] http://fisheye.codehaus.org/browse/plexus/plexus-components/trunk/plexus-archiver/src/main/java/org/codehaus/plexus/archiver/zip/AbstractZipUnArchiver.java?r=plexus-components:trunk#l57
> [2] http://fisheye.codehaus.org/browse/plexus/plexus-components/trunk/plexus-archiver/src/main/java/org/codehaus/plexus/archiver/zip/ZipFile.java?r=plexus-components:trunk#l83
> [3] http://fisheye.codehaus.org/browse/plexus/plexus-components/trunk/plexus-archiver/src/main/java/org/codehaus/plexus/archiver/zip/AbstractZipUnArchiver.java?r=plexus-components:trunk#l222
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Encoding issues with images using dependency and resource plugins?
Posted by Benjamin Bentmann <be...@udo.edu>.
Mauro Talevi wrote:
> I've tried setting UTF-8 encoding on resources plugin, but that makes
> the images unreadable on Mac.
Do you filter the images? AFAIK, the Resources Plugin should not alter a
file's contents during copying unless <filtering> is enabled on the
<resource> set.
If you filter your web stuff, you will need to exclude the images (and
any other files with binary content) from the filtering. I.e. define two
mutually exclusive <resource> sets, one for the text files to be
filtered and one for the binary stuff to be just copied over unaltered.
Ant's <copy> task also has a warning about filtering binary data [0].
> I note in passing that the dependency plugin uses the Plexus Unarchiver
> to unpack, but only the ZipUnarchiver allows to set the encoding
> property. Is there any reason why setEncoding() is not pulled up to
> Unarchiver interface?
ZipUnarchiver.setEncoding() only controls the encoding for file names as
given by zip entries [1,2], not the encoding of the compressed file
contents [3]. So unless you experience corrupt file names, that
shouldn't be the cause of your problem.
Benjamin
[0] http://ant.apache.org/manual/CoreTasks/copy.html#encoding
[1]
http://fisheye.codehaus.org/browse/plexus/plexus-components/trunk/plexus-archiver/src/main/java/org/codehaus/plexus/archiver/zip/AbstractZipUnArchiver.java?r=plexus-components:trunk#l57
[2]
http://fisheye.codehaus.org/browse/plexus/plexus-components/trunk/plexus-archiver/src/main/java/org/codehaus/plexus/archiver/zip/ZipFile.java?r=plexus-components:trunk#l83
[3]
http://fisheye.codehaus.org/browse/plexus/plexus-components/trunk/plexus-archiver/src/main/java/org/codehaus/plexus/archiver/zip/AbstractZipUnArchiver.java?r=plexus-components:trunk#l222
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org