Skip to content

Commit

Permalink
Include sun.jnu.encoding in bazel info character-encoding output
Browse files Browse the repository at this point in the history
The `sun.jnu.encoding` is what really determines the encoding used by Java file system APIs (both .io and .nio) rather than `file.encoding`. Making it more visible via an info item helps diagnose encoding bugs.

Closes bazelbuild#23469.

PiperOrigin-RevId: 670824910
Change-Id: Icba80b926b63090b0a5e5631e7aff673c9b71457
  • Loading branch information
fmeum authored and copybara-github committed Sep 4, 2024
1 parent d3e6866 commit 33ba589
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ public byte[] get(
Supplier<BuildConfigurationValue> configurationSupplier, CommandEnvironment env) {
return print(
String.format(
"file.encoding = %s, defaultCharset = %s",
System.getProperty("file.encoding", "unknown"), Charset.defaultCharset().name()));
"file.encoding = %s, defaultCharset = %s, sun.jnu.encoding = %s",
System.getProperty("file.encoding", "unknown"),
Charset.defaultCharset().name(),
System.getProperty("sun.jnu.encoding", "unknown")));
}
}

0 comments on commit 33ba589

Please sign in to comment.