Skip to content

Write generated sources with UTF-8 charset#147

Open
adamw7 wants to merge 1 commit into
mainfrom
claude/fix-filewriter-utf8
Open

Write generated sources with UTF-8 charset#147
adamw7 wants to merge 1 commit into
mainfrom
claude/fix-filewriter-utf8

Conversation

@adamw7
Copy link
Copy Markdown
Owner

@adamw7 adamw7 commented Apr 19, 2026

Summary

Code#write used FileWriter without a charset, so generated Java source was written using the platform default encoding. That breaks reproducibility across developer machines and CI (notably on Windows where the default is often cp1252).

Switched to Files.newBufferedWriter(..., StandardCharsets.UTF_8).

Test plan

  • mvn install at repo root builds
  • Existing code-generation tests still pass (MojoTest, ExampleTest, GeneretedCodeTest)

FileWriter used the platform default charset, which produces non-portable
output on systems where the default is not UTF-8 (e.g. Windows with a
cp1252 default). Generated Java source should always be written as UTF-8.
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.

2 participants