Tell javac the Java sources are UTF-8

The APK stopped building the moment the tree gained Java with prose in
it: 55 errors, every one "unmappable character (0x94)", every one from a
comment. The code was fine.

javac reads sources in the *platform* encoding, and the build container
sets no locale, so that is US-ASCII. Every curly quote and em dash in a
doc comment is then unrepresentable. The repository is UTF-8 throughout,
so this says so rather than asking one file's prose to be typed in ASCII
to suit a default nobody chose.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-30 10:07:48 +02:00
co-authored by Claude Opus 5
parent ef07e6ca3e
commit 126beaf7ed
+8
View File
@@ -140,8 +140,16 @@ if [[ ${#JAVA_FILES[@]} -gt 0 ]]; then
# `-Xlint:-options` silences one note, "source value 8 is obsolete", which
# is advice about a future JDK rather than about this code. The JDK is
# pinned in the Dockerfile, so the day it matters is a deliberate bump.
#
# `-encoding UTF-8` because javac otherwise reads sources in the *platform*
# encoding, and the container sets no locale, so that is US-ASCII. Every
# curly quote and em dash in a comment then becomes "unmappable character
# (0x94)" — 55 errors from prose, in a file whose code is fine. The sources
# are UTF-8 like everything else in the repo; this says so rather than
# asking the prose to be typed in ASCII.
javac \
-source 8 -target 8 \
-encoding UTF-8 \
-bootclasspath "${ANDROID_JAR}" \
-classpath "${ANDROID_JAR}" \
-Xlint:-options \