karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject [karaf] branch master updated: [KARAF-6112] Fix encoding in SshTerminal to works on Windows
Date Fri, 25 Jan 2019 16:41:51 GMT
This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/master by this push:
     new 9551dc2   [KARAF-6112] Fix encoding in SshTerminal to works on Windows
     new 7c06e1f  Merge pull request #739 from jbonofre/KARAF-6112
9551dc2 is described below

commit 9551dc2842f2467b965a6710a0c1ae223b3ccad3
Author: Jean-Baptiste Onofré <jbonofre@apache.org>
AuthorDate: Fri Jan 25 15:00:49 2019 +0100

     [KARAF-6112] Fix encoding in SshTerminal to works on Windows
---
 .../src/main/java/org/apache/karaf/shell/ssh/ShellFactoryImpl.java   | 2 +-
 shell/ssh/src/main/java/org/apache/karaf/shell/ssh/SshTerminal.java  | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellFactoryImpl.java b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellFactoryImpl.java
index 5c91cf5..4ee0b32 100644
--- a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellFactoryImpl.java
+++ b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellFactoryImpl.java
@@ -96,7 +96,7 @@ public class ShellFactoryImpl implements Factory<Command> {
                 final Subject subject = ShellImpl.this.session != null ? ShellImpl.this.session
                         .getAttribute(KarafJaasAuthenticator.SUBJECT_ATTRIBUTE_KEY) : null;
                 String encoding = getEncoding(env);
-                terminal = new SshTerminal(env, in, out);
+                terminal = new SshTerminal(env, in, out, encoding);
                 final PrintStream pout = new PrintStream(terminal.output(), true, encoding);
                 final PrintStream perr = err instanceof PrintStream ?
                         (PrintStream) err : out == err ? pout : new PrintStream(err, true,
encoding);
diff --git a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/SshTerminal.java b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/SshTerminal.java
index 2147a16..a166485 100644
--- a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/SshTerminal.java
+++ b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/SshTerminal.java
@@ -21,6 +21,7 @@ package org.apache.karaf.shell.ssh;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
 import java.util.EnumSet;
 import java.util.Map;
@@ -40,12 +41,12 @@ public class SshTerminal extends ExternalTerminal implements Terminal
{
 
     private Environment environment;
 
-    public SshTerminal(Environment environment, InputStream input, OutputStream output) throws
IOException {
+    public SshTerminal(Environment environment, InputStream input, OutputStream output, String
encoding) throws IOException {
         super("Karaf SSH terminal",
               environment.getEnv().get(Environment.ENV_TERM),
               input,
               output,
-              StandardCharsets.UTF_8);
+              Charset.forName(encoding));
         this.environment = environment;
         this.environment.addSignalListener(this::handleSignal);
         for (Map.Entry<PtyMode, Integer> e : environment.getPtyModes().entrySet())
{


Mime
View raw message