Skip to content
Permalink
Browse files
8274784: jshell: Garbled character was displayed by System.out.printl…
…n(...) on Japanese Windows

Reviewed-by: naoto
  • Loading branch information
Ichiroh Takiguchi committed Nov 29, 2021
1 parent e9b36a8 commit 8f9eb620acbc447cf9124b1fe5574a9f02115f45
@@ -55,7 +55,7 @@ public AbstractTerminal(String name, String type) throws IOException {
public AbstractTerminal(String name, String type, Charset encoding, SignalHandler signalHandler) throws IOException {
this.name = name;
this.type = type != null ? type : "ansi";
this.encoding = encoding != null ? encoding : Charset.defaultCharset();
this.encoding = encoding != null ? encoding : System.out.charset();
for (Signal signal : Signal.values()) {
handlers.put(signal, signalHandler);
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -63,8 +63,8 @@ public static void main(String[] args) throws Exception {
InputStream inStream = socket.getInputStream();
OutputStream outStream = socket.getOutputStream();
Map<String, Consumer<OutputStream>> outputs = new HashMap<>();
outputs.put("out", st -> System.setOut(new PrintStream(st, true)));
outputs.put("err", st -> System.setErr(new PrintStream(st, true)));
outputs.put("out", st -> System.setOut(new PrintStream(st, true, System.out.charset())));
outputs.put("err", st -> System.setErr(new PrintStream(st, true, System.err.charset())));
Map<String, Consumer<InputStream>> input = new HashMap<>();
input.put("in", System::setIn);
forwardExecutionControlAndIO(new RemoteExecutionControl(), inStream, outStream, outputs, input);

1 comment on commit 8f9eb62

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on 8f9eb62 Nov 29, 2021

Please sign in to comment.