문제

Per Jar specification manifest encoding has to be UTF-8. In some scenario (eg merge), manifests produced by ant's jar task got corrupted and special chars would be double encoded.

Original manifest (utf-8):

...
Application-Name: spécial
...

Final manifest (utf-8) after beeing processed by ant's jar task:

...
Application-Name: spécial
...
도움이 되었습니까?

해결책

Jar tasks beeing able to process file-sets allows the developper to specify the original manifest character encoding.

Unfortunately, although the mandatory (final) encoding is utf-8 there is no default in ant's jar task and then the original manifest processing is relying on the platform default... Windows-1252 in my case where the original manifest (coming from another jar) is truly in utf-8

Solution : specify the encoding in the task attribute

    <jar destfile="final.jar" filesetmanifest="merge" manifestencoding="UTF-8">
        <zipfileset src="original.jar">
    [...]
        </zipfileset>
    </jar>

다른 팁

I've just found my old bugreport about this for NetBeans.

As a workaround, I added manifestEncoding="${source.encoding}" attribute to the copylibs tag in build-impl.xml

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top