Skip to content

Commit

Permalink
Fix wrong output encoding on Windows with JDK >= 19
Browse files Browse the repository at this point in the history
JDK 19 has changed the system properties used for System.out and System.err encoding, see https://www.oracle.com/java/technologies/javase/19-relnote-issues.html#JDK-8283620
  • Loading branch information
gnodet committed Sep 25, 2023
1 parent cdb8d8c commit eae0e6f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/org/fusesource/jansi/AnsiConsole.java
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,10 @@ private static AnsiPrintStream ansiStream(boolean stdout) {
FileDescriptor descriptor = stdout ? FileDescriptor.out : FileDescriptor.err;
final OutputStream out = new FastBufferedOutputStream(new FileOutputStream(descriptor));

String enc = System.getProperty(stdout ? "sun.stdout.encoding" : "sun.stderr.encoding");
String enc = System.getProperty(stdout ? "stdout.encoding" : "stderr.encoding");
if (enc == null) {
enc = System.getProperty(stdout ? "sun.stdout.encoding" : "sun.stderr.encoding");
}

final boolean isatty;
boolean isAtty;
Expand Down

0 comments on commit eae0e6f

Please sign in to comment.