diff options
author | Thomas Wolf <thomas.wolf@paranor.ch> | 2021-09-03 19:49:27 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2021-10-26 17:49:20 -0400 |
commit | fc6fe793ce5c17a9270de443d09e38ff2fa45a43 (patch) | |
tree | b906d394fd439afd395403b41d70922224a22f14 /org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java | |
parent | ff3c3d8ff52eec0fff297b3ab056447599d589b2 (diff) | |
download | jgit-fc6fe793ce5c17a9270de443d09e38ff2fa45a43.tar.gz jgit-fc6fe793ce5c17a9270de443d09e38ff2fa45a43.zip |
Don't rely on an implicit default character set
JEP 400 (Java 18) will change the default character set to UTF-8
unconditionally.[1] Introduce SystemReader.getDefaultCharset() that
provides the locale-dependent charset the way JEP 400 recommends.
Change all code locations using Charset.defaultCharset() to use the
new SystemReader method instead.
[1] https://openjdk.java.net/jeps/400
Change-Id: I986f97a410d2fc70748b6f93228a2d45ff100b2c
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java index d44dc32d14..ff094f6975 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java @@ -13,7 +13,6 @@ package org.eclipse.jgit.util; import java.io.File; import java.io.IOException; -import java.nio.charset.Charset; import java.nio.file.FileVisitOption; import java.nio.file.FileVisitResult; import java.nio.file.Files; @@ -150,8 +149,10 @@ public class FS_Win32 extends FS { String w; try { w = readPipe(userHome(), - new String[]{"bash", "--login", "-c", "which git"}, // //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - Charset.defaultCharset().name()); + new String[] { "bash", "--login", "-c", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + "which git" }, // //$NON-NLS-1$ + SystemReader.getInstance().getDefaultCharset() + .name()); } catch (CommandFailedException e) { LOG.warn(e.getMessage()); return null; |