Manifest encoding broken

manifest file encoding is windows-1251 on my win 8 machine which is my locale and also is filesystem encoding. But should be utf-8

apply plugin: 'java’
jar {
manifest.attributes(‘foobar’: ‘бляха-муха! не та кодировка’)

Gradle 2.9

Build time: 2015-11-17 07:02:17 UTC
Build number: none
Revision: b463d7980c40d44c4657dc80025275b84a29e31f

Groovy: 2.4.4
Ant: Apache Ant™ version 1.9.3 compiled on December 23 2013
JVM: 1.8.0_45 (Oracle Corporation 25.45-b02)
OS: Windows 8 6.2 amd64

That is the default file encoding for Windows. If you want to use UTF-8 you’ll have to set the appropriate system property.

gradle -Dfile.encoding=UTF-8 jar

but manifest specification requires UTF-8

I’m not aware of any requirement that manifest files be encoded in UTF-8. They may contain UTF-8 encoded characters.

We simply use the platform default encoding (as some builds may rely on this behavior). If you make heavy use of non-standard characters I’d simply suggest forcing your build to use UTF-8.

utf-8 is not character set, unicode is
I think “any UTF-8 character except NUL, CR and LF” means exactly utf-8-encoded unicode characters.
Still think its a bug.

I’ve created GRADLE-3374 to track this.

1 Like