From 79b7f54e0421d18e6cd54e159455f5d8d35a6eed Mon Sep 17 00:00:00 2001 From: Duncan Tourolle Date: Sun, 30 Aug 2026 10:07:19 +0200 Subject: [PATCH] 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) --- docker/android/assemble-apk.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docker/android/assemble-apk.sh b/docker/android/assemble-apk.sh index dfa1f0a..6e11e09 100755 --- a/docker/android/assemble-apk.sh +++ b/docker/android/assemble-apk.sh @@ -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 \