Skip to content

build: declare UTF-8 source encoding, so Windows reads the sources correctly - #2047

Merged
jcschaff merged 1 commit into
masterfrom
build/utf8-source-encoding
Sep 1, 2026
Merged

jcschaff merged 1 commit into
masterfrom
build/utf8-source-encoding

Conversation

@jcschaff

@jcschaff jcschaff commented Sep 1, 2026

Copy link
Copy Markdown
Member

Closes #2046.

One property. The root pom.xml set no source encoding, so maven-compiler-plugin used the platform default charset — UTF-8 on Linux and macOS, windows-1252 on Windows. The same sources became different text depending on who built them.

Surfaced when the client E2E workflow (#2045) compiled this repo on a windows-latest runner — the first time it has been built on Windows in CI.

Two failure modes, and the quiet one matters more

Five files fail outright:

[ERROR] .../org/vcell/pathway/PathwayModel.java:[237,136]
        unmappable character (0x9D) for encoding windows-1252

109 more compile cleanly and produce the wrong characters. Their bytes all happen to be defined in windows-1252, so javac never complains — it just decodes them as something else, and it reaches user-visible strings:

new JButton("▶")   ->   a button labelled "â–¶"

Fixing only the five loud ones would leave a developer with a corrupted client and no signal that anything was wrong.

Verified, not assumed

I can't run Windows here, so I forced the charset javac would default to there (MAVEN_OPTS=-Dfile.encoding=windows-1252) and read the compiled class, not the build log:

unmappable errors compiled play-button constant
without the fix 1 — PathwayModel.java:237, the exact CI error mojibake â–¶
with the fix 0 correct U+25B6

Both categories, both directions.

Risk

Low, and asymmetric. This declares what is already true rather than converting anything — all 114 affected files decode cleanly as UTF-8 today. On Linux and macOS nothing changes, because UTF-8 was already the default there; the normal build passes unchanged.

Released artifacts were never affected, since release builds run on Linux. This is for anyone building on Windows, and for the Windows lane of the client E2E.

project.reporting.outputEncoding is set alongside it for the same reason, and because Maven warns about it once the source encoding is declared.

Follow-up

.github/workflows/client-e2e.yml (in #2045) passes -Dproject.build.sourceEncoding=UTF-8 on the command line as a local workaround. That line becomes redundant once this lands and should be deleted — whichever of the two merges second.

🤖 Generated with Claude Code

https://claude.ai/code/session_01D71LBYmQNf5J94wPqr81Jx

…rrectly

Closes #2046.

Without this the compiler uses the PLATFORM default charset: UTF-8 on Linux and macOS,
windows-1252 on Windows. The same sources become different text depending on who builds
them. It surfaced when the client E2E workflow compiled this repo on a windows-latest
runner - the first time it had been built on Windows in CI.

Five files fail outright ("unmappable character (0x9D) for encoding windows-1252"), and
109 more compile CLEANLY as windows-1252 and yield the wrong characters. That second
group is the dangerous one, because it reaches user-visible strings with a green build:

    new JButton("▶")   ->   a button labelled "â–¶"

Verified by forcing the charset javac would default to on Windows
(MAVEN_OPTS=-Dfile.encoding=windows-1252) and reading the COMPILED class, not the log:

                     unmappable errors    compiled play-button constant
    without the fix          1            mojibake "â–¶"
    with the fix             0            correct U+25B6

This declares what is already true rather than converting anything - all 114 of those
files decode cleanly as UTF-8 today - and it changes nothing on Linux or macOS, where
UTF-8 was already the default. Released artifacts were never affected, since release
builds run on Linux; this is for anyone building on Windows.

project.reporting.outputEncoding is set alongside it for the same reason, and because
Maven warns about it being unset once the source encoding is declared.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D71LBYmQNf5J94wPqr81Jx
@jcschaff
jcschaff merged commit 9aef5a8 into master Sep 1, 2026
9 checks passed
jcschaff added a commit that referenced this pull request Sep 1, 2026
#2047 set project.build.sourceEncoding=UTF-8 in the root pom, so passing it on the
command line here is redundant. Removing it as promised in that PR.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D71LBYmQNf5J94wPqr81Jx
@jcschaff
jcschaff deleted the build/utf8-source-encoding branch September 1, 2026 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build has no source encoding set: Windows reads UTF-8 sources as windows-1252

1 participant