Skip to content

Commit 2683eb1

Browse files
committed
build: compile sources as UTF-8 rather than the build JVM default
1 parent aba7bf2 commit 2683eb1

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎build.gradle‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,9 @@ java {
7070
sourceCompatibility = JavaVersion.VERSION_1_8
7171
targetCompatibility = JavaVersion.VERSION_1_8
7272
}
73+
74+
// javac leaves the source encoding unset, so it follows whatever the build JVM reports, and that
75+
// is not reliably anything: measured on one Windows box with JDK 17, Gradle 8.11.1 read these
76+
// sources as Cp1252 while 7.6.4 read them as UTF-8. Pinning it makes the compiled bytes the same
77+
// everywhere rather than a property of the build that ran.
78+
tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' }

0 commit comments

Comments
 (0)