diff options
Diffstat (limited to 'org.eclipse.jgit.lfs')
-rw-r--r-- | org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPointer.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPointer.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPointer.java index c0cf2337be..bbea53567f 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPointer.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPointer.java @@ -48,6 +48,9 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintStream; +import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; +import java.nio.charset.UnsupportedCharsetException; import org.eclipse.jgit.annotations.Nullable; import org.eclipse.jgit.lfs.lib.AnyLongObjectId; @@ -109,13 +112,18 @@ public class LfsPointer { * written */ public void encode(OutputStream out) { - try (PrintStream ps = new PrintStream(out)) { + try (PrintStream ps = new PrintStream(out, false, + StandardCharsets.UTF_8.name())) { ps.print("version "); //$NON-NLS-1$ - ps.println(VERSION); + ps.print(VERSION + "\n"); //$NON-NLS-1$ ps.print("oid " + HASH_FUNCTION_NAME + ":"); //$NON-NLS-1$ //$NON-NLS-2$ - ps.println(oid.name()); + ps.print(oid.name() + "\n"); //$NON-NLS-1$ ps.print("size "); //$NON-NLS-1$ - ps.println(size); + ps.print(size + "\n"); //$NON-NLS-1$ + } catch (UnsupportedEncodingException e) { + // should not happen, we are using a standard charset + throw new UnsupportedCharsetException( + StandardCharsets.UTF_8.name()); } } @@ -137,7 +145,7 @@ public class LfsPointer { long sz = -1; try (BufferedReader br = new BufferedReader( - new InputStreamReader(in))) { + new InputStreamReader(in, StandardCharsets.UTF_8.name()))) { for (String s = br.readLine(); s != null; s = br.readLine()) { if (s.startsWith("#") || s.length() == 0) { //$NON-NLS-1$ continue; |