diff options
Diffstat (limited to 'org.eclipse.jgit.pgm/src/org')
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTool.java | 9 | ||||
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeTool.java | 14 |
2 files changed, 18 insertions, 5 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTool.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTool.java index 3113eeb640..87c71795ec 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTool.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTool.java @@ -19,6 +19,7 @@ import java.io.BufferedReader; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; +import java.nio.charset.Charset; import java.text.MessageFormat; import java.util.List; import java.util.Map; @@ -244,11 +245,15 @@ class DiffTool extends TextBuiltin { // TODO: check how to return the exit-code of the tool // to jgit / java runtime ? // int rc =... + Charset defaultCharset = SystemReader.getInstance() + .getDefaultCharset(); outw.println( - new String(result.getStdout().toByteArray())); + new String(result.getStdout().toByteArray(), + defaultCharset)); outw.flush(); errw.println( - new String(result.getStderr().toByteArray())); + new String(result.getStderr().toByteArray(), + defaultCharset)); errw.flush(); } } catch (ToolException e) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeTool.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeTool.java index 2a411b81fe..a382fab757 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeTool.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeTool.java @@ -18,6 +18,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; +import java.nio.charset.Charset; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collections; @@ -55,6 +56,7 @@ import org.eclipse.jgit.treewalk.TreeWalk; import org.eclipse.jgit.treewalk.WorkingTreeOptions; import org.eclipse.jgit.treewalk.filter.PathFilterGroup; import org.eclipse.jgit.util.FS.ExecutionResult; +import org.eclipse.jgit.util.SystemReader; import org.kohsuke.args4j.Argument; import org.kohsuke.args4j.Option; import org.kohsuke.args4j.spi.RestOfArgumentsHandler; @@ -108,7 +110,9 @@ class MergeTool extends TextBuiltin { protected void init(Repository repository, String gitDir) { super.init(repository, gitDir); mergeTools = new MergeTools(repository); - inputReader = new BufferedReader(new InputStreamReader(ins)); + inputReader = new BufferedReader( + new InputStreamReader(ins, + SystemReader.getInstance().getDefaultCharset())); } enum MergeResult { @@ -285,9 +289,13 @@ class MergeTool extends TextBuiltin { gui, this::promptForLaunch, this::informUserNoTool); if (optionalResult.isPresent()) { ExecutionResult result = optionalResult.get(); - outw.println(new String(result.getStdout().toByteArray())); + Charset defaultCharset = SystemReader.getInstance() + .getDefaultCharset(); + outw.println(new String(result.getStdout().toByteArray(), + defaultCharset)); outw.flush(); - errw.println(new String(result.getStderr().toByteArray())); + errw.println(new String(result.getStderr().toByteArray(), + defaultCharset)); errw.flush(); } else { return MergeResult.ABORTED; |