Consistently use Constants.CHARSET rather than StandardCharsets.UTF_8

Change-Id: I6714fc3666e1bced22abba94ceb700477349586e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
diff --git a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java
index 9379f02..9ed60d9 100644
--- a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java
+++ b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java
@@ -42,6 +42,8 @@
  */
 package org.eclipse.jgit.archive;
 
+import static org.eclipse.jgit.lib.Constants.CHARACTER_ENCODING;
+
 import java.io.IOException;
 import java.io.OutputStream;
 import java.text.MessageFormat;
@@ -82,7 +84,8 @@ public ArchiveOutputStream createArchiveOutputStream(OutputStream s)
 	@Override
 	public ArchiveOutputStream createArchiveOutputStream(OutputStream s,
 			Map<String, Object> o) throws IOException {
-		TarArchiveOutputStream out = new TarArchiveOutputStream(s, "UTF-8"); //$NON-NLS-1$
+		TarArchiveOutputStream out = new TarArchiveOutputStream(s,
+				CHARACTER_ENCODING);
 		out.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX);
 		out.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX);
 		return applyFormatOptions(out, o);
@@ -97,7 +100,7 @@ public void putEntry(ArchiveOutputStream out,
 			final TarArchiveEntry entry = new TarArchiveEntry(
 					path, TarConstants.LF_SYMLINK);
 			entry.setLinkName(new String(
-					loader.getCachedBytes(100), "UTF-8")); //$NON-NLS-1$
+					loader.getCachedBytes(100), CHARACTER_ENCODING));
 			out.putArchiveEntry(entry);
 			out.closeArchiveEntry();
 			return;
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
index 5f40be4..6ded21f 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.http.test;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.eclipse.jgit.util.HttpSupport.HDR_CONTENT_ENCODING;
 import static org.eclipse.jgit.util.HttpSupport.HDR_CONTENT_LENGTH;
 import static org.eclipse.jgit.util.HttpSupport.HDR_CONTENT_TYPE;
@@ -1084,7 +1084,7 @@ public void testInitialClone_BrokenServer() throws Exception {
 	public void testInvalidWant() throws Exception {
 		@SuppressWarnings("resource")
 		ObjectId id = new ObjectInserter.Formatter().idFor(Constants.OBJ_BLOB,
-				"testInvalidWant".getBytes(UTF_8));
+				"testInvalidWant".getBytes(CHARSET));
 
 		Repository dst = createBareRepository();
 		try (Transport t = Transport.open(dst, remoteURI);
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/JGitTestUtil.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/JGitTestUtil.java
index cef81a0..27f745e 100644
--- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/JGitTestUtil.java
+++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/JGitTestUtil.java
@@ -45,7 +45,7 @@
 
 package org.eclipse.jgit.junit;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -246,7 +246,7 @@ public static void write(final File f, final String body)
 			throws IOException {
 		FileUtils.mkdirs(f.getParentFile(), true);
 		try (Writer w = new OutputStreamWriter(new FileOutputStream(f),
-				UTF_8)) {
+				CHARSET)) {
 			w.write(body);
 		}
 	}
@@ -263,7 +263,7 @@ public static void write(final File f, final String body)
 	 */
 	public static String read(final File file) throws IOException {
 		final byte[] body = IO.readFully(file);
-		return new String(body, 0, body.length, UTF_8);
+		return new String(body, 0, body.length, CHARSET);
 	}
 
 	/**
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java
index 568bc3b..3c00bd3 100644
--- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java
+++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java
@@ -45,7 +45,7 @@
 
 package org.eclipse.jgit.junit;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.fail;
 
@@ -352,7 +352,7 @@ public static String indexState(Repository repo, int includedOptions)
 			if (0 != (includedOptions & CONTENT)) {
 				sb.append(", content:"
 						+ new String(repo.open(entry.getObjectId(),
-						Constants.OBJ_BLOB).getCachedBytes(), UTF_8));
+						Constants.OBJ_BLOB).getCachedBytes(), CHARSET));
 			}
 			if (0 != (includedOptions & ASSUME_UNCHANGED))
 				sb.append(", assume-unchanged:"
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java
index afc2c44..5a83a1f 100644
--- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java
+++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java
@@ -46,7 +46,7 @@
 
 package org.eclipse.jgit.junit;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.junit.Assert.assertEquals;
 
 import java.io.File;
@@ -199,7 +199,7 @@ protected void deleteTrashFile(final String name) throws IOException {
 	protected static void checkFile(File f, final String checkData)
 			throws IOException {
 		try (Reader r = new InputStreamReader(new FileInputStream(f),
-				UTF_8)) {
+				CHARSET)) {
 			if (checkData.length() > 0) {
 				char[] data = new char[checkData.length()];
 				assertEquals(data.length, r.read(data));
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java
index 41634e7..89a86d8 100644
--- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java
+++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.junit;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
@@ -268,7 +268,7 @@ public void setAuthorAndCommitter(org.eclipse.jgit.lib.CommitBuilder c) {
 	 * @throws Exception
 	 */
 	public RevBlob blob(final String content) throws Exception {
-		return blob(content.getBytes(UTF_8));
+		return blob(content.getBytes(CHARSET));
 	}
 
 	/**
diff --git a/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/LfsServerTest.java b/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/LfsServerTest.java
index 10823b8..50a06f9 100644
--- a/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/LfsServerTest.java
+++ b/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/LfsServerTest.java
@@ -42,7 +42,7 @@
  */
 package org.eclipse.jgit.lfs.server.fs;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.junit.Assert.assertEquals;
 
 import java.io.BufferedInputStream;
@@ -211,11 +211,11 @@ private void checkResponseStatus(HttpResponse response) {
 				if (buf.hasArray()) {
 					error = new String(buf.array(),
 							buf.arrayOffset() + buf.position(), buf.remaining(),
-							UTF_8);
+							CHARSET);
 				} else {
 					final byte[] b = new byte[buf.remaining()];
 					buf.duplicate().get(b);
-					error = new String(b, UTF_8);
+					error = new String(b, CHARSET);
 				}
 			} catch (IOException e) {
 				error = statusLine.getReasonPhrase();
diff --git a/org.eclipse.jgit.lfs.server/META-INF/MANIFEST.MF b/org.eclipse.jgit.lfs.server/META-INF/MANIFEST.MF
index 690abb2..28b1231 100644
--- a/org.eclipse.jgit.lfs.server/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.lfs.server/META-INF/MANIFEST.MF
@@ -31,6 +31,7 @@
  org.eclipse.jgit.lfs.errors;version="[5.0.0,5.1.0)",
  org.eclipse.jgit.lfs.internal;version="[5.0.0,5.1.0)",
  org.eclipse.jgit.lfs.lib;version="[5.0.0,5.1.0)",
+ org.eclipse.jgit.lib;version="[5.0.0,5.1.0)",
  org.eclipse.jgit.nls;version="[5.0.0,5.1.0)",
  org.eclipse.jgit.transport.http;version="[5.0.0,5.1.0)",
  org.eclipse.jgit.transport.http.apache;version="[5.0.0,5.1.0)",
diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java
index c7f55dd..d22d459 100644
--- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java
+++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java
@@ -42,7 +42,7 @@
  */
 package org.eclipse.jgit.lfs.server;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.apache.http.HttpStatus.SC_FORBIDDEN;
 import static org.apache.http.HttpStatus.SC_INSUFFICIENT_STORAGE;
 import static org.apache.http.HttpStatus.SC_INTERNAL_SERVER_ERROR;
@@ -202,10 +202,10 @@ public boolean isVerify() {
 	protected void doPost(HttpServletRequest req, HttpServletResponse res)
 			throws ServletException, IOException {
 		Writer w = new BufferedWriter(
-				new OutputStreamWriter(res.getOutputStream(), UTF_8));
+				new OutputStreamWriter(res.getOutputStream(), CHARSET));
 
 		Reader r = new BufferedReader(
-				new InputStreamReader(req.getInputStream(), UTF_8));
+				new InputStreamReader(req.getInputStream(), CHARSET));
 		LfsRequest request = LfsGson.fromJson(r, LfsRequest.class);
 		String path = req.getPathInfo();
 
diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/SignerV4.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/SignerV4.java
index b21c94e..374a560 100644
--- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/SignerV4.java
+++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/SignerV4.java
@@ -43,7 +43,7 @@
  */
 package org.eclipse.jgit.lfs.server.s3;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.eclipse.jgit.util.HttpSupport.HDR_AUTHORIZATION;
 
 import java.io.UnsupportedEncodingException;
@@ -359,13 +359,13 @@ private static String canonicalizeResourcePath(URL endpoint) {
 
 	private static byte[] hash(String s) {
 		MessageDigest md = Constants.newMessageDigest();
-		md.update(s.getBytes(UTF_8));
+		md.update(s.getBytes(CHARSET));
 		return md.digest();
 	}
 
 	private static byte[] sign(String stringData, byte[] key) {
 		try {
-			byte[] data = stringData.getBytes(UTF_8);
+			byte[] data = stringData.getBytes(CHARSET);
 			Mac mac = Mac.getInstance(HMACSHA256);
 			mac.init(new SecretKeySpec(key, HMACSHA256));
 			return mac.doFinal(data);
@@ -395,7 +395,7 @@ private static String toHex(byte[] bytes) {
 	private static String urlEncode(String url, boolean keepPathSlash) {
 		String encoded;
 		try {
-			encoded = URLEncoder.encode(url, UTF_8.name());
+			encoded = URLEncoder.encode(url, CHARSET.name());
 		} catch (UnsupportedEncodingException e) {
 			throw new RuntimeException(LfsServerText.get().unsupportedUtf8, e);
 		}
diff --git a/org.eclipse.jgit.lfs.test/src/org/eclipse/jgit/lfs/test/LongObjectIdTestUtils.java b/org.eclipse.jgit.lfs.test/src/org/eclipse/jgit/lfs/test/LongObjectIdTestUtils.java
index c3c3859..e3c6ef8 100644
--- a/org.eclipse.jgit.lfs.test/src/org/eclipse/jgit/lfs/test/LongObjectIdTestUtils.java
+++ b/org.eclipse.jgit.lfs.test/src/org/eclipse/jgit/lfs/test/LongObjectIdTestUtils.java
@@ -42,7 +42,7 @@
  */
 package org.eclipse.jgit.lfs.test;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 
 import java.io.BufferedInputStream;
 import java.io.FileNotFoundException;
@@ -66,7 +66,7 @@ public class LongObjectIdTestUtils {
 	 */
 	public static LongObjectId hash(String s) {
 		MessageDigest md = Constants.newMessageDigest();
-		md.update(s.getBytes(UTF_8));
+		md.update(s.getBytes(CHARSET));
 		return LongObjectId.fromRaw(md.digest());
 	}
 
diff --git a/org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LFSPointerTest.java b/org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LFSPointerTest.java
index 146a25e..a1283dd 100644
--- a/org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LFSPointerTest.java
+++ b/org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LFSPointerTest.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.lfs.lib;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARACTER_ENCODING;
 import static org.junit.Assert.assertEquals;
 
 import java.io.ByteArrayOutputStream;
@@ -66,7 +66,7 @@ public void testEncoding() throws IOException {
 			assertEquals(
 					"version https://git-lfs.github.com/spec/v1\noid sha256:"
 							+ s + "\nsize 4\n",
-					baos.toString(UTF_8.name()));
+					baos.toString(CHARACTER_ENCODING));
 		}
 	}
 }
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 0e3830c..4f95940 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
@@ -42,7 +42,7 @@
  */
 package org.eclipse.jgit.lfs;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 
 import java.io.BufferedReader;
 import java.io.IOException;
@@ -134,7 +134,7 @@ public long getSize() {
 	 */
 	public void encode(OutputStream out) {
 		try (PrintStream ps = new PrintStream(out, false,
-				UTF_8.name())) {
+				CHARSET.name())) {
 			ps.print("version "); //$NON-NLS-1$
 			ps.print(VERSION + "\n"); //$NON-NLS-1$
 			ps.print("oid " + HASH_FUNCTION_NAME + ":"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -143,7 +143,7 @@ public void encode(OutputStream out) {
 			ps.print(size + "\n"); //$NON-NLS-1$
 		} catch (UnsupportedEncodingException e) {
 			// should not happen, we are using a standard charset
-			throw new UnsupportedCharsetException(UTF_8.name());
+			throw new UnsupportedCharsetException(CHARSET.name());
 		}
 	}
 
@@ -165,7 +165,7 @@ public static LfsPointer parseLfsPointer(InputStream in)
 		long sz = -1;
 
 		try (BufferedReader br = new BufferedReader(
-				new InputStreamReader(in, UTF_8))) {
+				new InputStreamReader(in, CHARSET))) {
 			for (String s = br.readLine(); s != null; s = br.readLine()) {
 				if (s.startsWith("#") || s.length() == 0) { //$NON-NLS-1$
 					continue;
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPrePushHook.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPrePushHook.java
index c522572..7fd7c21 100644
--- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPrePushHook.java
+++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPrePushHook.java
@@ -42,7 +42,7 @@
  */
 package org.eclipse.jgit.lfs;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.eclipse.jgit.lfs.Protocol.OPERATION_UPLOAD;
 import static org.eclipse.jgit.lfs.internal.LfsConnectionFactory.toRequest;
 import static org.eclipse.jgit.transport.http.HttpConnection.HTTP_OK;
@@ -204,7 +204,7 @@ private Map<String, LfsPointer> requestBatchUpload(HttpConnection api,
 		}
 		Gson gson = Protocol.gson();
 		api.getOutputStream().write(
-				gson.toJson(toRequest(OPERATION_UPLOAD, res)).getBytes(UTF_8));
+				gson.toJson(toRequest(OPERATION_UPLOAD, res)).getBytes(CHARSET));
 		int responseCode = api.getResponseCode();
 		if (responseCode != HTTP_OK) {
 			throw new IOException(
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java
index e2ab309..6bff12f 100644
--- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java
+++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java
@@ -42,11 +42,12 @@
  */
 package org.eclipse.jgit.lfs;
 
+import static org.eclipse.jgit.lib.Constants.CHARSET;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
-import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.text.MessageFormat;
@@ -169,7 +170,7 @@ public static Collection<Path> downloadLfsResource(Lfs lfs, Repository db,
 				.write(gson
 						.toJson(LfsConnectionFactory
 								.toRequest(Protocol.OPERATION_DOWNLOAD, res))
-						.getBytes(StandardCharsets.UTF_8));
+						.getBytes(CHARSET));
 		int responseCode = lfsServerConn.getResponseCode();
 		if (responseCode != HttpConnection.HTTP_OK) {
 			throw new IOException(
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ArchiveTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ArchiveTest.java
index e5c85eb..e992ddf 100644
--- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ArchiveTest.java
+++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ArchiveTest.java
@@ -42,7 +42,7 @@
  */
 package org.eclipse.jgit.pgm;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
@@ -612,7 +612,7 @@ private Process spawnAssumingCommandPresent(String... cmdline) {
 
 	private BufferedReader readFromProcess(Process proc) throws Exception {
 		return new BufferedReader(
-				new InputStreamReader(proc.getInputStream(), UTF_8));
+				new InputStreamReader(proc.getInputStream(), CHARSET));
 	}
 
 	private void grepForEntry(String name, String mode, String... cmdline)
@@ -750,7 +750,7 @@ public Object call() throws IOException {
 			// found!
 			List<String> l = new ArrayList<>();
 			BufferedReader reader = new BufferedReader(
-					new InputStreamReader(in, UTF_8));
+					new InputStreamReader(in, CHARSET));
 			String line;
 			while ((line = reader.readLine()) != null)
 				l.add(line);
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java
index 81aeef8..0bc80f7 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.pgm;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 
 import java.io.BufferedReader;
 import java.io.IOException;
@@ -151,7 +151,7 @@ private void scan(final URL cUrl) {
 		final BufferedReader cIn;
 		try {
 			final InputStream in = cUrl.openStream();
-			cIn = new BufferedReader(new InputStreamReader(in, UTF_8));
+			cIn = new BufferedReader(new InputStreamReader(in, CHARSET));
 		} catch (IOException err) {
 			// If we cannot read from the service list, go to the next.
 			//
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java
index a376bc0..75612be 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java
@@ -44,7 +44,7 @@
 
 package org.eclipse.jgit.pgm;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 
 import java.io.File;
 import java.io.IOException;
@@ -217,7 +217,7 @@ protected void run(final String[] argv) throws Exception {
 	}
 
 	PrintWriter createErrorWriter() {
-		return new PrintWriter(new OutputStreamWriter(System.err, UTF_8));
+		return new PrintWriter(new OutputStreamWriter(System.err, CHARSET));
 	}
 
 	private void execute(final String[] argv) throws Exception {
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/BenchmarkReftable.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/BenchmarkReftable.java
index 248eaac..575a122 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/BenchmarkReftable.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/BenchmarkReftable.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.pgm.debug;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.eclipse.jgit.lib.Constants.HEAD;
 import static org.eclipse.jgit.lib.Constants.MASTER;
 import static org.eclipse.jgit.lib.Constants.R_HEADS;
@@ -154,7 +154,7 @@ private RefList<Ref> readLsRemote()
 			throws IOException, FileNotFoundException {
 		RefList.Builder<Ref> list = new RefList.Builder<>();
 		try (BufferedReader br = new BufferedReader(new InputStreamReader(
-				new FileInputStream(lsRemotePath), UTF_8))) {
+				new FileInputStream(lsRemotePath), CHARSET))) {
 			Ref last = null;
 			String line;
 			while ((line = br.readLine()) != null) {
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteReftable.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteReftable.java
index 6cbc1b0..c5ea028 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteReftable.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteReftable.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.pgm.debug;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.eclipse.jgit.lib.Constants.HEAD;
 import static org.eclipse.jgit.lib.Constants.MASTER;
 import static org.eclipse.jgit.lib.Constants.R_HEADS;
@@ -192,7 +192,7 @@ private void printf(String fmt, Object... args) throws IOException {
 	static List<Ref> readRefs(String inputFile) throws IOException {
 		List<Ref> refs = new ArrayList<>();
 		try (BufferedReader br = new BufferedReader(
-				new InputStreamReader(new FileInputStream(inputFile), UTF_8))) {
+				new InputStreamReader(new FileInputStream(inputFile), CHARSET))) {
 			String line;
 			while ((line = br.readLine()) != null) {
 				ObjectId id = ObjectId.fromString(line.substring(0, 40));
@@ -227,7 +227,7 @@ private static List<LogEntry> readLog(String logPath)
 
 		List<LogEntry> log = new ArrayList<>();
 		try (BufferedReader br = new BufferedReader(
-				new InputStreamReader(new FileInputStream(logPath), UTF_8))) {
+				new InputStreamReader(new FileInputStream(logPath), CHARSET))) {
 			@SuppressWarnings("nls")
 			Pattern pattern = Pattern.compile("([^,]+)" // 1: ref
 					+ ",([0-9]+(?:[.][0-9]+)?)" // 2: time
diff --git a/org.eclipse.jgit.test/exttst/org/eclipse/jgit/ignore/CGitVsJGitRandomIgnorePatternTest.java b/org.eclipse.jgit.test/exttst/org/eclipse/jgit/ignore/CGitVsJGitRandomIgnorePatternTest.java
index 438d2d6..4d9e864 100644
--- a/org.eclipse.jgit.test/exttst/org/eclipse/jgit/ignore/CGitVsJGitRandomIgnorePatternTest.java
+++ b/org.eclipse.jgit.test/exttst/org/eclipse/jgit/ignore/CGitVsJGitRandomIgnorePatternTest.java
@@ -42,7 +42,7 @@
  */
 package org.eclipse.jgit.ignore;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -158,7 +158,7 @@ public CGitIgnoreRule(File gitDir, String pattern) throws IOException {
 			this.gitDir = gitDir;
 			this.pattern = pattern;
 			Files.write(FileUtils.toPath(new File(gitDir, ".gitignore")),
-					(pattern + "\n").getBytes(UTF_8), StandardOpenOption.CREATE,
+					(pattern + "\n").getBytes(CHARSET), StandardOpenOption.CREATE,
 					StandardOpenOption.TRUNCATE_EXISTING,
 					StandardOpenOption.WRITE);
 		}
@@ -188,7 +188,7 @@ private Process startCgitCheckIgnore(String path) throws IOException {
 			Process proc = Runtime.getRuntime().exec(command, new String[0],
 					gitDir);
 			try (OutputStream out = proc.getOutputStream()) {
-				out.write((path + "\n").getBytes(UTF_8));
+				out.write((path + "\n").getBytes(CHARSET));
 				out.flush();
 			}
 			return proc;
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/EolStreamTypeUtilTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/EolStreamTypeUtilTest.java
index 1e3a39a..bb303cc 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/EolStreamTypeUtilTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/EolStreamTypeUtilTest.java
@@ -42,7 +42,7 @@
 
 package org.eclipse.jgit.api;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.eclipse.jgit.lib.CoreConfig.EolStreamType.AUTO_CRLF;
 import static org.eclipse.jgit.lib.CoreConfig.EolStreamType.AUTO_LF;
 import static org.eclipse.jgit.lib.CoreConfig.EolStreamType.DIRECT;
@@ -150,8 +150,8 @@ private void testCheckout(EolStreamType streamTypeText,
 			EolStreamType streamTypeWithBinaryCheck, String output,
 			String expectedConversion) throws Exception {
 		ByteArrayOutputStream b;
-		byte[] outputBytes = output.getBytes(UTF_8);
-		byte[] expectedConversionBytes = expectedConversion.getBytes(UTF_8);
+		byte[] outputBytes = output.getBytes(CHARSET);
+		byte[] expectedConversionBytes = expectedConversion.getBytes(CHARSET);
 
 		// test using output text and assuming it was declared TEXT
 		b = new ByteArrayOutputStream();
@@ -277,8 +277,8 @@ public void testCheckinCRLF() throws Exception {
 	private void testCheckin(EolStreamType streamTypeText,
 			EolStreamType streamTypeWithBinaryCheck, String input,
 			String expectedConversion) throws Exception {
-		byte[] inputBytes = input.getBytes(UTF_8);
-		byte[] expectedConversionBytes = expectedConversion.getBytes(UTF_8);
+		byte[] inputBytes = input.getBytes(CHARSET);
+		byte[] expectedConversionBytes = expectedConversion.getBytes(CHARSET);
 
 		// test using input text and assuming it was declared TEXT
 		try (InputStream in = EolStreamTypeUtil.wrapInputStream(
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/NotesCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/NotesCommandTest.java
index 6e06e95..e234aa3 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/NotesCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/NotesCommandTest.java
@@ -42,7 +42,7 @@
  */
 package org.eclipse.jgit.api;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.junit.Assert.assertEquals;
 
 import java.util.List;
@@ -88,7 +88,7 @@ public void testAddAndRemoveNote() throws Exception {
 		git.notesAdd().setObjectId(commit2).setMessage("data").call();
 		Note note = git.notesShow().setObjectId(commit2).call();
 		String content = new String(db.open(note.getData()).getCachedBytes(),
-				UTF_8);
+				CHARSET);
 		assertEquals(content, "data");
 
 		git.notesRemove().setObjectId(commit2).call();
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java
index 9461c42..0b0e3bf 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java
@@ -42,7 +42,7 @@
  */
 package org.eclipse.jgit.api;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -592,7 +592,7 @@ public void setUp() throws Exception {
 	private static void writeToFile(File actFile, String string)
 			throws IOException {
 		try (FileOutputStream fos = new FileOutputStream(actFile)) {
-			fos.write(string.getBytes(UTF_8));
+			fos.write(string.getBytes(CHARSET));
 		}
 	}
 
@@ -606,7 +606,7 @@ private static void assertFileContentsEqual(File actFile, String string)
 				bos.write(buffer, 0, read);
 				read = fis.read(buffer);
 			}
-			String content = new String(bos.toByteArray(), UTF_8);
+			String content = new String(bos.toByteArray(), CHARSET);
 			assertEquals(string, content);
 		}
 	}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java
index 913b4ac..b349c66 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java
@@ -42,7 +42,7 @@
  */
 package org.eclipse.jgit.api;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -396,7 +396,7 @@ public void setUp() throws Exception {
 	private static void writeToFile(File actFile, String string)
 			throws IOException {
 		try (FileOutputStream fos = new FileOutputStream(actFile)) {
-			fos.write(string.getBytes(UTF_8));
+			fos.write(string.getBytes(CHARSET));
 		}
 	}
 
@@ -410,7 +410,7 @@ private static void assertFileContentsEqual(File actFile, String string)
 				bos.write(buffer, 0, read);
 				read = fis.read(buffer);
 			}
-			String content = new String(bos.toByteArray(), UTF_8);
+			String content = new String(bos.toByteArray(), CHARSET);
 			assertEquals(string, content);
 		}
 	}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java
index 2bf91ae..96e7091 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java
@@ -42,7 +42,7 @@
  */
 package org.eclipse.jgit.api;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.not;
 import static org.hamcrest.MatcherAssert.assertThat;
@@ -1464,7 +1464,7 @@ public void testAuthorScriptConverter() throws Exception {
 		assertEquals("GIT_AUTHOR_DATE='@123456789 -0100'", lines[2]);
 
 		PersonIdent parsedIdent = git.rebase().parseAuthor(
-				convertedAuthor.getBytes(UTF_8));
+				convertedAuthor.getBytes(CHARSET));
 		assertEquals(ident.getName(), parsedIdent.getName());
 		assertEquals(ident.getEmailAddress(), parsedIdent.getEmailAddress());
 		// this is rounded to the last second
@@ -1481,7 +1481,7 @@ public void testAuthorScriptConverter() throws Exception {
 		assertEquals("GIT_AUTHOR_DATE='@123456789 +0930'", lines[2]);
 
 		parsedIdent = git.rebase().parseAuthor(
-				convertedAuthor.getBytes(UTF_8));
+				convertedAuthor.getBytes(CHARSET));
 		assertEquals(ident.getName(), parsedIdent.getName());
 		assertEquals(ident.getEmailAddress(), parsedIdent.getEmailAddress());
 		assertEquals(123456789000L, parsedIdent.getWhen().getTime());
@@ -2104,7 +2104,7 @@ private int countPicks() throws IOException {
 		int count = 0;
 		File todoFile = getTodoFile();
 		try (BufferedReader br = new BufferedReader(new InputStreamReader(
-				new FileInputStream(todoFile), UTF_8))) {
+				new FileInputStream(todoFile), CHARSET))) {
 			String line = br.readLine();
 			while (line != null) {
 				int firstBlank = line.indexOf(' ');
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/AbstractDiffTestCase.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/AbstractDiffTestCase.java
index 0f13a68..32f3421 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/AbstractDiffTestCase.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/AbstractDiffTestCase.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.diff;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
@@ -240,6 +240,6 @@ public static RawText t(String text) {
 			r.append(text.charAt(i));
 			r.append('\n');
 		}
-		return new RawText(r.toString().getBytes(UTF_8));
+		return new RawText(r.toString().getBytes(CHARSET));
 	}
 }
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/RawTextTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/RawTextTest.java
index 6ad59b9..69e4077 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/RawTextTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/RawTextTest.java
@@ -44,7 +44,7 @@
 
 package org.eclipse.jgit.diff;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
@@ -136,8 +136,8 @@ public void testComparatorReduceCommonStartEnd() {
 		e = c.reduceCommonStartEnd(t("abQxy"), t("abRxy"), e);
 		assertEquals(new Edit(2, 3, 2, 3), e);
 
-		RawText a = new RawText("p\na b\nQ\nc d\n".getBytes(UTF_8));
-		RawText b = new RawText("p\na  b \nR\n c  d \n".getBytes(UTF_8));
+		RawText a = new RawText("p\na b\nQ\nc d\n".getBytes(CHARSET));
+		RawText b = new RawText("p\na  b \nR\n c  d \n".getBytes(CHARSET));
 		e = new Edit(0, 4, 0, 4);
 		e = RawTextComparator.WS_IGNORE_ALL.reduceCommonStartEnd(a, b, e);
 		assertEquals(new Edit(2, 3, 2, 3), e);
@@ -149,14 +149,14 @@ public void testComparatorReduceCommonStartEnd_EmptyLine() {
 		RawText b;
 		Edit e;
 
-		a = new RawText("R\n y\n".getBytes(UTF_8));
-		b = new RawText("S\n\n y\n".getBytes(UTF_8));
+		a = new RawText("R\n y\n".getBytes(CHARSET));
+		b = new RawText("S\n\n y\n".getBytes(CHARSET));
 		e = new Edit(0, 2, 0, 3);
 		e = RawTextComparator.DEFAULT.reduceCommonStartEnd(a, b, e);
 		assertEquals(new Edit(0, 1, 0, 2), e);
 
-		a = new RawText("S\n\n y\n".getBytes(UTF_8));
-		b = new RawText("R\n y\n".getBytes(UTF_8));
+		a = new RawText("S\n\n y\n".getBytes(CHARSET));
+		b = new RawText("R\n y\n".getBytes(CHARSET));
 		e = new Edit(0, 3, 0, 2);
 		e = RawTextComparator.DEFAULT.reduceCommonStartEnd(a, b, e);
 		assertEquals(new Edit(0, 2, 0, 1), e);
@@ -167,8 +167,8 @@ public void testComparatorReduceCommonStartButLastLineNoEol() {
 		RawText a;
 		RawText b;
 		Edit e;
-		a = new RawText("start".getBytes(UTF_8));
-		b = new RawText("start of line".getBytes(UTF_8));
+		a = new RawText("start".getBytes(CHARSET));
+		b = new RawText("start of line".getBytes(CHARSET));
 		e = new Edit(0, 1, 0, 1);
 		e = RawTextComparator.DEFAULT.reduceCommonStartEnd(a, b, e);
 		assertEquals(new Edit(0, 1, 0, 1), e);
@@ -179,8 +179,8 @@ public void testComparatorReduceCommonStartButLastLineNoEol_2() {
 		RawText a;
 		RawText b;
 		Edit e;
-		a = new RawText("start".getBytes(UTF_8));
-		b = new RawText("start of\nlastline".getBytes(UTF_8));
+		a = new RawText("start".getBytes(CHARSET));
+		b = new RawText("start of\nlastline".getBytes(CHARSET));
 		e = new Edit(0, 1, 0, 2);
 		e = RawTextComparator.DEFAULT.reduceCommonStartEnd(a, b, e);
 		assertEquals(new Edit(0, 1, 0, 2), e);
@@ -239,6 +239,6 @@ private static RawText t(String text) {
 			r.append(text.charAt(i));
 			r.append('\n');
 		}
-		return new RawText(r.toString().getBytes(UTF_8));
+		return new RawText(r.toString().getBytes(CHARSET));
 	}
 }
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/SimilarityIndexTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/SimilarityIndexTest.java
index f168e83..51a6f81 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/SimilarityIndexTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/SimilarityIndexTest.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.diff;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
@@ -82,7 +82,7 @@ public void testIndexingLargeObject() throws IOException,
 				+ "A\n" //
 				+ "B\n" //
 				+ "B\n" //
-				+ "B\n").getBytes(UTF_8);
+				+ "B\n").getBytes(CHARSET);
 		SimilarityIndex si = new SimilarityIndex();
 		si.hash(new ByteArrayInputStream(in), in.length, false);
 		assertEquals(2, si.size());
@@ -130,12 +130,12 @@ public void testCommonScoreLargeObject_SameFiles_CR_canonicalization()
 				+ "D\r\n" //
 				+ "B\r\n";
 		SimilarityIndex src = new SimilarityIndex();
-		byte[] bytes1 = text.getBytes(UTF_8);
+		byte[] bytes1 = text.getBytes(CHARSET);
 		src.hash(new ByteArrayInputStream(bytes1), bytes1.length, true);
 		src.sort();
 
 		SimilarityIndex dst = new SimilarityIndex();
-		byte[] bytes2 = text.replace("\r", "").getBytes(UTF_8);
+		byte[] bytes2 = text.replace("\r", "").getBytes(CHARSET);
 		dst.hash(new ByteArrayInputStream(bytes2), bytes2.length, true);
 		dst.sort();
 
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java
index dec1762..80d4329 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.dircache;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.eclipse.jgit.junit.Assert.assertEquals;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
@@ -236,7 +236,7 @@ private static File pathOf(final String name) {
 	private static Map<String, CGitIndexRecord> readLsFiles() throws Exception {
 		final LinkedHashMap<String, CGitIndexRecord> r = new LinkedHashMap<>();
 		try (BufferedReader br = new BufferedReader(new InputStreamReader(
-				new FileInputStream(pathOf("gitgit.lsfiles")), UTF_8))) {
+				new FileInputStream(pathOf("gitgit.lsfiles")), CHARSET))) {
 			String line;
 			while ((line = br.readLine()) != null) {
 				final CGitIndexRecord cr = new CGitIndexRecord(line);
@@ -249,7 +249,7 @@ private static Map<String, CGitIndexRecord> readLsFiles() throws Exception {
 	private static Map<String, CGitLsTreeRecord> readLsTree() throws Exception {
 		final LinkedHashMap<String, CGitLsTreeRecord> r = new LinkedHashMap<>();
 		try (BufferedReader br = new BufferedReader(new InputStreamReader(
-				new FileInputStream(pathOf("gitgit.lstree")), UTF_8))) {
+				new FileInputStream(pathOf("gitgit.lstree")), CHARSET))) {
 			String line;
 			while ((line = br.readLine()) != null) {
 				final CGitLsTreeRecord cr = new CGitLsTreeRecord(line);
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/ManifestParserTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/ManifestParserTest.java
index c9673a6..69a48cc 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/ManifestParserTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/ManifestParserTest.java
@@ -42,7 +42,7 @@
  */
 package org.eclipse.jgit.gitrepo;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -82,7 +82,7 @@ public void testManifestParser() throws Exception {
 
 		ManifestParser parser = new ManifestParser(
 				null, null, "master", baseUrl, null, null);
-		parser.read(new ByteArrayInputStream(xmlContent.toString().getBytes(UTF_8)));
+		parser.read(new ByteArrayInputStream(xmlContent.toString().getBytes(CHARSET)));
 		// Unfiltered projects should have them all.
 		results.clear();
 		results.add("foo");
@@ -136,7 +136,7 @@ public void testManifestParserWithMissingFetchOnRemote() throws Exception {
 				baseUrl, null, null);
 		try {
 			parser.read(new ByteArrayInputStream(
-					xmlContent.toString().getBytes(UTF_8)));
+					xmlContent.toString().getBytes(CHARSET)));
 			fail("ManifestParser did not throw exception for missing fetch");
 		} catch (IOException e) {
 			assertTrue(e.getCause() instanceof SAXException);
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java
index 2253a04..6f6dd5f 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java
@@ -42,7 +42,7 @@
  */
 package org.eclipse.jgit.gitrepo;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
@@ -214,7 +214,7 @@ public void runTwiceIsNOP() throws Exception {
 
 		RevCommit commit = cmd
 			.setInputStream(new ByteArrayInputStream(
-				xmlContent.toString().getBytes(UTF_8)))
+				xmlContent.toString().getBytes(CHARSET)))
 			.setRemoteReader(repos)
 			.setURI("platform/")
 			.setTargetURI("platform/superproject")
@@ -225,7 +225,7 @@ public void runTwiceIsNOP() throws Exception {
 		String firstIdStr = commit.getId().name() + ":" + ".gitmodules";
 		commit = new RepoCommand(dest)
 			.setInputStream(new ByteArrayInputStream(
-				xmlContent.toString().getBytes(UTF_8)))
+				xmlContent.toString().getBytes(CHARSET)))
 			.setRemoteReader(repos)
 			.setURI("platform/")
 			.setTargetURI("platform/superproject")
@@ -266,7 +266,7 @@ public void androidSetup() throws Exception {
 		repos.put("platform/base", child);
 
 		RevCommit commit = cmd
-			.setInputStream(new ByteArrayInputStream(xmlContent.toString().getBytes(UTF_8)))
+			.setInputStream(new ByteArrayInputStream(xmlContent.toString().getBytes(CHARSET)))
 			.setRemoteReader(repos)
 			.setURI("platform/")
 			.setTargetURI("platform/superproject")
@@ -308,7 +308,7 @@ public void recordUnreachableRemotes() throws Exception {
 
 		RevCommit commit = new RepoCommand(dest)
 			.setInputStream(new ByteArrayInputStream(
-				xmlContent.toString().getBytes(UTF_8)))
+				xmlContent.toString().getBytes(CHARSET)))
 			.setRemoteReader(new IndexedRepos())
 			.setURI("platform/")
 			.setTargetURI("platform/superproject")
@@ -358,7 +358,7 @@ public void gerritSetup() throws Exception {
 		repos.put("plugins/cookbook", child);
 
 		RevCommit commit = cmd
-			.setInputStream(new ByteArrayInputStream(xmlContent.toString().getBytes(UTF_8)))
+			.setInputStream(new ByteArrayInputStream(xmlContent.toString().getBytes(CHARSET)))
 			.setRemoteReader(repos)
 			.setURI("")
 			.setTargetURI("gerrit")
@@ -412,7 +412,7 @@ public void absoluteRemoteURL() throws Exception {
 				repos.put(repoUrl, child);
 
 				RevCommit commit = cmd
-					.setInputStream(new ByteArrayInputStream(xmlContent.toString().getBytes(UTF_8)))
+					.setInputStream(new ByteArrayInputStream(xmlContent.toString().getBytes(CHARSET)))
 					.setRemoteReader(repos)
 					.setURI(baseUrl)
 					.setTargetURI("gerrit")
@@ -469,7 +469,7 @@ public void absoluteRemoteURLAbsoluteTargetURL() throws Exception {
 				repos.put(repoUrl, child);
 
 				RevCommit commit = cmd
-					.setInputStream(new ByteArrayInputStream(xmlContent.toString().getBytes(UTF_8)))
+					.setInputStream(new ByteArrayInputStream(xmlContent.toString().getBytes(CHARSET)))
 					.setRemoteReader(repos)
 					.setURI(baseUrl)
 					.setTargetURI(abs + "/superproject")
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java
index 17c7ef1..80595fe 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java
@@ -42,7 +42,7 @@
  */
 package org.eclipse.jgit.ignore;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.eclipse.jgit.junit.Assert.assertEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -765,6 +765,6 @@ private InputStream writeToString(String... rules) {
 		for (String line : rules) {
 			data.append(line + "\n");
 		}
-		return new ByteArrayInputStream(data.toString().getBytes(UTF_8));
+		return new ByteArrayInputStream(data.toString().getBytes(CHARSET));
 	}
 }
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/indexdiff/IndexDiffWithSymlinkTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/indexdiff/IndexDiffWithSymlinkTest.java
index d5d3857..26c11c7 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/indexdiff/IndexDiffWithSymlinkTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/indexdiff/IndexDiffWithSymlinkTest.java
@@ -41,7 +41,7 @@
  */
 package org.eclipse.jgit.indexdiff;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -128,7 +128,7 @@ private File restoreGitRepo(InputStream in, File testDir, String name)
 		File restoreScript = new File(testDir, name + ".sh");
 		try (OutputStream out = new BufferedOutputStream(
 				new FileOutputStream(restoreScript));
-				Writer writer = new OutputStreamWriter(out, UTF_8)) {
+				Writer writer = new OutputStreamWriter(out, CHARSET)) {
 			writer.write("echo `which git` 1>&2\n");
 			writer.write("echo `git --version` 1>&2\n");
 			writer.write("git init " + name + " && \\\n");
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefUpdateTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefUpdateTest.java
index 52861ec..592d0c8 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefUpdateTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefUpdateTest.java
@@ -45,7 +45,7 @@
 
 package org.eclipse.jgit.internal.storage.file;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.eclipse.jgit.junit.Assert.assertEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -252,7 +252,7 @@ public void testDeleteHeadInBareRepo() throws IOException {
 
 		ObjectId blobId;
 		try (ObjectInserter ins = bareRepo.newObjectInserter()) {
-			blobId = ins.insert(Constants.OBJ_BLOB, "contents".getBytes(UTF_8));
+			blobId = ins.insert(Constants.OBJ_BLOB, "contents".getBytes(CHARSET));
 			ins.flush();
 		}
 
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java
index d7505af..b5d6485 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java
@@ -47,7 +47,7 @@
 package org.eclipse.jgit.internal.storage.file;
 
 import static java.nio.charset.StandardCharsets.ISO_8859_1;
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -522,7 +522,7 @@ public void test023_createCommitNonAnullii() throws IOException {
 				4294967295000L, 60));
 		commit.setCommitter(new PersonIdent("Joe Hacker", "joe2@example.com",
 				4294967295000L, 60));
-		commit.setEncoding(UTF_8);
+		commit.setEncoding(CHARSET);
 		commit.setMessage("\u00dcbergeeks");
 		ObjectId cid = insertCommit(commit);
 		assertEquals("4680908112778718f37e686cbebcc912730b3154", cid.name());
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/junit/TestRepositoryTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/junit/TestRepositoryTest.java
index b7027f3..965899e 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/junit/TestRepositoryTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/junit/TestRepositoryTest.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.junit;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
@@ -418,6 +418,6 @@ private String blobAsString(AnyObjectId treeish, String path)
 		RevObject obj = tr.get(rw.parseTree(treeish), path);
 		assertSame(RevBlob.class, obj.getClass());
 		ObjectLoader loader = rw.getObjectReader().open(obj);
-		return new String(loader.getCachedBytes(), UTF_8);
+		return new String(loader.getCachedBytes(), CHARSET);
 	}
 }
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java
index f1c62d4..22c66ce 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java
@@ -45,7 +45,7 @@
 package org.eclipse.jgit.lib;
 
 import static java.lang.Integer.valueOf;
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.eclipse.jgit.junit.JGitTestUtil.concat;
 import static org.eclipse.jgit.lib.Constants.OBJECT_ID_LENGTH;
 import static org.eclipse.jgit.lib.Constants.OBJ_BAD;
@@ -1454,7 +1454,7 @@ public void testInvalidTreeDuplicateNames5()
 		StringBuilder b = new StringBuilder();
 		entry(b, "100644 A");
 		entry(b, "100644 a");
-		byte[] data = b.toString().getBytes(UTF_8);
+		byte[] data = b.toString().getBytes(CHARSET);
 		checker.setSafeForWindows(true);
 		assertCorrupt("duplicate entry names", OBJ_TREE, data);
 		assertSkipListAccepts(OBJ_TREE, data);
@@ -1468,7 +1468,7 @@ public void testInvalidTreeDuplicateNames6()
 		StringBuilder b = new StringBuilder();
 		entry(b, "100644 A");
 		entry(b, "100644 a");
-		byte[] data = b.toString().getBytes(UTF_8);
+		byte[] data = b.toString().getBytes(CHARSET);
 		checker.setSafeForMacOS(true);
 		assertCorrupt("duplicate entry names", OBJ_TREE, data);
 		assertSkipListAccepts(OBJ_TREE, data);
@@ -1482,7 +1482,7 @@ public void testInvalidTreeDuplicateNames7()
 		StringBuilder b = new StringBuilder();
 		entry(b, "100644 \u0065\u0301");
 		entry(b, "100644 \u00e9");
-		byte[] data = b.toString().getBytes(UTF_8);
+		byte[] data = b.toString().getBytes(CHARSET);
 		checker.setSafeForMacOS(true);
 		assertCorrupt("duplicate entry names", OBJ_TREE, data);
 		assertSkipListAccepts(OBJ_TREE, data);
@@ -1496,7 +1496,7 @@ public void testInvalidTreeDuplicateNames8()
 		StringBuilder b = new StringBuilder();
 		entry(b, "100644 A");
 		checker.setSafeForMacOS(true);
-		checker.checkTree(b.toString().getBytes(UTF_8));
+		checker.checkTree(b.toString().getBytes(CHARSET));
 	}
 
 	@Test
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/ResolveMergerTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/ResolveMergerTest.java
index 9322a47..9734ac8 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/ResolveMergerTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/ResolveMergerTest.java
@@ -42,7 +42,7 @@
  */
 package org.eclipse.jgit.merge;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.eclipse.jgit.lib.Constants.OBJ_BLOB;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -756,7 +756,7 @@ public void checkContentMergeLargeBinaries(MergeStrategy strategy) throws Except
 		}
 		binary[50] = '\0';
 
-		writeTrashFile("file", new String(binary, UTF_8));
+		writeTrashFile("file", new String(binary, CHARSET));
 		git.add().addFilepattern("file").call();
 		RevCommit first = git.commit().setMessage("added file").call();
 
@@ -764,7 +764,7 @@ public void checkContentMergeLargeBinaries(MergeStrategy strategy) throws Except
 		int idx = LINELEN * 1200 + 1;
 		byte save = binary[idx];
 		binary[idx] = '@';
-		writeTrashFile("file", new String(binary, UTF_8));
+		writeTrashFile("file", new String(binary, CHARSET));
 
 		binary[idx] = save;
 		git.add().addFilepattern("file").call();
@@ -773,7 +773,7 @@ public void checkContentMergeLargeBinaries(MergeStrategy strategy) throws Except
 
 		git.checkout().setCreateBranch(true).setStartPoint(first).setName("side").call();
 		binary[LINELEN * 1500 + 1] = '!';
-		writeTrashFile("file", new String(binary, UTF_8));
+		writeTrashFile("file", new String(binary, CHARSET));
 		git.add().addFilepattern("file").call();
 		RevCommit sideCommit = git.commit().setAll(true)
 			.setMessage("modified file l 1500").call();
@@ -935,7 +935,7 @@ public void checkContentMergeConflict_noTree(MergeStrategy strategy)
 			merger.getMergeResults().get("file");
 			try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
 				fmt.formatMerge(out, merger.getMergeResults().get("file"),
-						"BASE", "OURS", "THEIRS", UTF_8.name());
+						"BASE", "OURS", "THEIRS", CHARSET.name());
 				String expected = "<<<<<<< OURS\n"
 						+ "1master\n"
 						+ "=======\n"
@@ -943,7 +943,7 @@ public void checkContentMergeConflict_noTree(MergeStrategy strategy)
 						+ ">>>>>>> THEIRS\n"
 						+ "2\n"
 						+ "3";
-				assertEquals(expected, new String(out.toByteArray(), UTF_8));
+				assertEquals(expected, new String(out.toByteArray(), CHARSET));
 			}
 		}
 	}
@@ -1328,6 +1328,6 @@ private String readBlob(ObjectId treeish, String path) throws Exception {
 		if (obj == null) {
 			return null;
 		}
-		return new String(rw.getObjectReader().open(obj, OBJ_BLOB).getBytes(), UTF_8);
+		return new String(rw.getObjectReader().open(obj, OBJ_BLOB).getBytes(), CHARSET);
 	}
 }
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/GetTextTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/GetTextTest.java
index 65375c7..8da199f 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/GetTextTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/GetTextTest.java
@@ -44,7 +44,7 @@
 package org.eclipse.jgit.patch;
 
 import static java.nio.charset.StandardCharsets.ISO_8859_1;
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -83,7 +83,7 @@ public void testGetText_NoBinary() throws IOException {
 	@Test
 	public void testGetText_Convert() throws IOException {
 		final Charset csOld = ISO_8859_1;
-		final Charset csNew = UTF_8;
+		final Charset csNew = CHARSET;
 		final Patch p = parseTestPatchFile();
 		assertTrue(p.getErrors().isEmpty());
 		assertEquals(1, p.getFiles().size());
@@ -103,7 +103,7 @@ public void testGetText_Convert() throws IOException {
 	@Test
 	public void testGetText_DiffCc() throws IOException {
 		final Charset csOld = ISO_8859_1;
-		final Charset csNew = UTF_8;
+		final Charset csNew = CHARSET;
 		final Patch p = parseTestPatchFile();
 		assertTrue(p.getErrors().isEmpty());
 		assertEquals(1, p.getFiles().size());
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitParseTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitParseTest.java
index 88f240b..9fc9621 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitParseTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitParseTest.java
@@ -44,7 +44,7 @@
 package org.eclipse.jgit.revwalk;
 
 import static java.nio.charset.StandardCharsets.ISO_8859_1;
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
@@ -114,7 +114,7 @@ public void testParse_NoParents() throws Exception {
 		assertNull(c.getTree());
 		assertNull(c.parents);
 
-		c.parseCanonical(rw, body.toString().getBytes(UTF_8));
+		c.parseCanonical(rw, body.toString().getBytes(CHARSET));
 		assertNotNull(c.getTree());
 		assertEquals(treeId, c.getTree().getId());
 		assertSame(rw.lookupTree(treeId), c.getTree());
@@ -148,7 +148,7 @@ private RevCommit create(final String msg) throws Exception {
 
 		final RevCommit c;
 		c = new RevCommit(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
-		c.parseCanonical(new RevWalk(db), b.toString().getBytes(UTF_8));
+		c.parseCanonical(new RevWalk(db), b.toString().getBytes(CHARSET));
 		return c;
 	}
 
@@ -161,7 +161,7 @@ public void testParse_WeirdHeaderOnlyCommit() throws Exception {
 
 		final RevCommit c;
 		c = new RevCommit(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
-		c.parseCanonical(new RevWalk(db), b.toString().getBytes(UTF_8));
+		c.parseCanonical(new RevWalk(db), b.toString().getBytes(CHARSET));
 
 		assertEquals("", c.getFullMessage());
 		assertEquals("", c.getShortMessage());
@@ -176,7 +176,7 @@ public void testParse_incompleteAuthorAndCommitter() throws Exception {
 
 		final RevCommit c;
 		c = new RevCommit(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
-		c.parseCanonical(new RevWalk(db), b.toString().getBytes(UTF_8));
+		c.parseCanonical(new RevWalk(db), b.toString().getBytes(CHARSET));
 
 		assertEquals(new PersonIdent("", "a_u_thor@example.com", 1218123387000l, 7), c.getAuthorIdent());
 		assertEquals(new PersonIdent("", "", 1218123390000l, -5), c.getCommitterIdent());
@@ -185,13 +185,13 @@ public void testParse_incompleteAuthorAndCommitter() throws Exception {
 	@Test
 	public void testParse_implicit_UTF8_encoded() throws Exception {
 		final ByteArrayOutputStream b = new ByteArrayOutputStream();
-		b.write("tree 9788669ad918b6fcce64af8882fc9a81cb6aba67\n".getBytes(UTF_8));
-		b.write("author F\u00f6r fattare <a_u_thor@example.com> 1218123387 +0700\n".getBytes(UTF_8));
-		b.write("committer C O. Miter <c@example.com> 1218123390 -0500\n".getBytes(UTF_8));
-		b.write("\n".getBytes(UTF_8));
-		b.write("Sm\u00f6rg\u00e5sbord\n".getBytes(UTF_8));
-		b.write("\n".getBytes(UTF_8));
-		b.write("\u304d\u308c\u3044\n".getBytes(UTF_8));
+		b.write("tree 9788669ad918b6fcce64af8882fc9a81cb6aba67\n".getBytes(CHARSET));
+		b.write("author F\u00f6r fattare <a_u_thor@example.com> 1218123387 +0700\n".getBytes(CHARSET));
+		b.write("committer C O. Miter <c@example.com> 1218123390 -0500\n".getBytes(CHARSET));
+		b.write("\n".getBytes(CHARSET));
+		b.write("Sm\u00f6rg\u00e5sbord\n".getBytes(CHARSET));
+		b.write("\n".getBytes(CHARSET));
+		b.write("\u304d\u308c\u3044\n".getBytes(CHARSET));
 		final RevCommit c;
 		c = new RevCommit(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67")); // bogus id
 		c.parseCanonical(new RevWalk(db), b.toByteArray());
@@ -205,13 +205,13 @@ public void testParse_implicit_UTF8_encoded() throws Exception {
 	@Test
 	public void testParse_implicit_mixed_encoded() throws Exception {
 		final ByteArrayOutputStream b = new ByteArrayOutputStream();
-		b.write("tree 9788669ad918b6fcce64af8882fc9a81cb6aba67\n".getBytes(UTF_8));
+		b.write("tree 9788669ad918b6fcce64af8882fc9a81cb6aba67\n".getBytes(CHARSET));
 		b.write("author F\u00f6r fattare <a_u_thor@example.com> 1218123387 +0700\n".getBytes(ISO_8859_1));
-		b.write("committer C O. Miter <c@example.com> 1218123390 -0500\n".getBytes(UTF_8));
-		b.write("\n".getBytes(UTF_8));
-		b.write("Sm\u00f6rg\u00e5sbord\n".getBytes(UTF_8));
-		b.write("\n".getBytes(UTF_8));
-		b.write("\u304d\u308c\u3044\n".getBytes(UTF_8));
+		b.write("committer C O. Miter <c@example.com> 1218123390 -0500\n".getBytes(CHARSET));
+		b.write("\n".getBytes(CHARSET));
+		b.write("Sm\u00f6rg\u00e5sbord\n".getBytes(CHARSET));
+		b.write("\n".getBytes(CHARSET));
+		b.write("\u304d\u308c\u3044\n".getBytes(CHARSET));
 		final RevCommit c;
 		c = new RevCommit(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67")); // bogus id
 		c.parseCanonical(new RevWalk(db), b.toByteArray());
@@ -260,14 +260,14 @@ public void testParse_explicit_encoded() throws Exception {
 	@Test
 	public void testParse_explicit_bad_encoded() throws Exception {
 		final ByteArrayOutputStream b = new ByteArrayOutputStream();
-		b.write("tree 9788669ad918b6fcce64af8882fc9a81cb6aba67\n".getBytes(UTF_8));
+		b.write("tree 9788669ad918b6fcce64af8882fc9a81cb6aba67\n".getBytes(CHARSET));
 		b.write("author F\u00f6r fattare <a_u_thor@example.com> 1218123387 +0700\n".getBytes(ISO_8859_1));
-		b.write("committer C O. Miter <c@example.com> 1218123390 -0500\n".getBytes(UTF_8));
-		b.write("encoding EUC-JP\n".getBytes(UTF_8));
-		b.write("\n".getBytes(UTF_8));
-		b.write("\u304d\u308c\u3044\n".getBytes(UTF_8));
-		b.write("\n".getBytes(UTF_8));
-		b.write("Hi\n".getBytes(UTF_8));
+		b.write("committer C O. Miter <c@example.com> 1218123390 -0500\n".getBytes(CHARSET));
+		b.write("encoding EUC-JP\n".getBytes(CHARSET));
+		b.write("\n".getBytes(CHARSET));
+		b.write("\u304d\u308c\u3044\n".getBytes(CHARSET));
+		b.write("\n".getBytes(CHARSET));
+		b.write("Hi\n".getBytes(CHARSET));
 		final RevCommit c;
 		c = new RevCommit(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67")); // bogus id
 		c.parseCanonical(new RevWalk(db), b.toByteArray());
@@ -291,14 +291,14 @@ public void testParse_explicit_bad_encoded() throws Exception {
 	@Test
 	public void testParse_explicit_bad_encoded2() throws Exception {
 		final ByteArrayOutputStream b = new ByteArrayOutputStream();
-		b.write("tree 9788669ad918b6fcce64af8882fc9a81cb6aba67\n".getBytes(UTF_8));
-		b.write("author F\u00f6r fattare <a_u_thor@example.com> 1218123387 +0700\n".getBytes(UTF_8));
-		b.write("committer C O. Miter <c@example.com> 1218123390 -0500\n".getBytes(UTF_8));
-		b.write("encoding ISO-8859-1\n".getBytes(UTF_8));
-		b.write("\n".getBytes(UTF_8));
-		b.write("\u304d\u308c\u3044\n".getBytes(UTF_8));
-		b.write("\n".getBytes(UTF_8));
-		b.write("Hi\n".getBytes(UTF_8));
+		b.write("tree 9788669ad918b6fcce64af8882fc9a81cb6aba67\n".getBytes(CHARSET));
+		b.write("author F\u00f6r fattare <a_u_thor@example.com> 1218123387 +0700\n".getBytes(CHARSET));
+		b.write("committer C O. Miter <c@example.com> 1218123390 -0500\n".getBytes(CHARSET));
+		b.write("encoding ISO-8859-1\n".getBytes(CHARSET));
+		b.write("\n".getBytes(CHARSET));
+		b.write("\u304d\u308c\u3044\n".getBytes(CHARSET));
+		b.write("\n".getBytes(CHARSET));
+		b.write("Hi\n".getBytes(CHARSET));
 		final RevCommit c;
 		c = new RevCommit(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67")); // bogus id
 		c.parseCanonical(new RevWalk(db), b.toByteArray());
@@ -313,13 +313,13 @@ public void testParse_explicit_bad_encoded2() throws Exception {
 	public void testParse_incorrectUtf8Name() throws Exception {
 		ByteArrayOutputStream b = new ByteArrayOutputStream();
 		b.write("tree 9788669ad918b6fcce64af8882fc9a81cb6aba67\n"
-				.getBytes(UTF_8));
-		b.write("author au <a@example.com> 1218123387 +0700\n".getBytes(UTF_8));
+				.getBytes(CHARSET));
+		b.write("author au <a@example.com> 1218123387 +0700\n".getBytes(CHARSET));
 		b.write("committer co <c@example.com> 1218123390 -0500\n"
-				.getBytes(UTF_8));
-		b.write("encoding 'utf8'\n".getBytes(UTF_8));
-		b.write("\n".getBytes(UTF_8));
-		b.write("Sm\u00f6rg\u00e5sbord\n".getBytes(UTF_8));
+				.getBytes(CHARSET));
+		b.write("encoding 'utf8'\n".getBytes(CHARSET));
+		b.write("\n".getBytes(CHARSET));
+		b.write("Sm\u00f6rg\u00e5sbord\n".getBytes(CHARSET));
 
 		RevCommit c = new RevCommit(
 				id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
@@ -338,12 +338,12 @@ public void testParse_incorrectUtf8Name() throws Exception {
 	@Test
 	public void testParse_illegalEncoding() throws Exception {
 		ByteArrayOutputStream b = new ByteArrayOutputStream();
-		b.write("tree 9788669ad918b6fcce64af8882fc9a81cb6aba67\n".getBytes(UTF_8));
-		b.write("author au <a@example.com> 1218123387 +0700\n".getBytes(UTF_8));
-		b.write("committer co <c@example.com> 1218123390 -0500\n".getBytes(UTF_8));
-		b.write("encoding utf-8logoutputencoding=gbk\n".getBytes(UTF_8));
-		b.write("\n".getBytes(UTF_8));
-		b.write("message\n".getBytes(UTF_8));
+		b.write("tree 9788669ad918b6fcce64af8882fc9a81cb6aba67\n".getBytes(CHARSET));
+		b.write("author au <a@example.com> 1218123387 +0700\n".getBytes(CHARSET));
+		b.write("committer co <c@example.com> 1218123390 -0500\n".getBytes(CHARSET));
+		b.write("encoding utf-8logoutputencoding=gbk\n".getBytes(CHARSET));
+		b.write("\n".getBytes(CHARSET));
+		b.write("message\n".getBytes(CHARSET));
 
 		RevCommit c = new RevCommit(
 				id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
@@ -365,12 +365,12 @@ public void testParse_illegalEncoding() throws Exception {
 	@Test
 	public void testParse_unsupportedEncoding() throws Exception {
 		ByteArrayOutputStream b = new ByteArrayOutputStream();
-		b.write("tree 9788669ad918b6fcce64af8882fc9a81cb6aba67\n".getBytes(UTF_8));
-		b.write("author au <a@example.com> 1218123387 +0700\n".getBytes(UTF_8));
-		b.write("committer co <c@example.com> 1218123390 -0500\n".getBytes(UTF_8));
-		b.write("encoding it_IT.UTF8\n".getBytes(UTF_8));
-		b.write("\n".getBytes(UTF_8));
-		b.write("message\n".getBytes(UTF_8));
+		b.write("tree 9788669ad918b6fcce64af8882fc9a81cb6aba67\n".getBytes(CHARSET));
+		b.write("author au <a@example.com> 1218123387 +0700\n".getBytes(CHARSET));
+		b.write("committer co <c@example.com> 1218123390 -0500\n".getBytes(CHARSET));
+		b.write("encoding it_IT.UTF8\n".getBytes(CHARSET));
+		b.write("\n".getBytes(CHARSET));
+		b.write("message\n".getBytes(CHARSET));
 
 		RevCommit c = new RevCommit(
 				id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevTagParseTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevTagParseTest.java
index 38bd371..8e95079 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevTagParseTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevTagParseTest.java
@@ -44,7 +44,7 @@
 package org.eclipse.jgit.revwalk;
 
 import static java.nio.charset.StandardCharsets.ISO_8859_1;
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
@@ -98,7 +98,7 @@ private void testOneType(final int typeCode) throws Exception {
 		assertNull(c.getObject());
 		assertNull(c.getTagName());
 
-		c.parseCanonical(rw, b.toString().getBytes(UTF_8));
+		c.parseCanonical(rw, b.toString().getBytes(CHARSET));
 		assertNotNull(c.getObject());
 		assertEquals(id, c.getObject().getId());
 		assertSame(rw.lookupAny(id, typeCode), c.getObject());
@@ -141,7 +141,7 @@ public void testParseAllFields() throws Exception {
 		assertNull(c.getObject());
 		assertNull(c.getTagName());
 
-		c.parseCanonical(rw, body.toString().getBytes(UTF_8));
+		c.parseCanonical(rw, body.toString().getBytes(CHARSET));
 		assertNotNull(c.getObject());
 		assertEquals(treeId, c.getObject().getId());
 		assertSame(rw.lookupTree(treeId), c.getObject());
@@ -189,7 +189,7 @@ public void testParseOldStyleNoTagger() throws Exception {
 		assertNull(c.getObject());
 		assertNull(c.getTagName());
 
-		c.parseCanonical(rw, body.toString().getBytes(UTF_8));
+		c.parseCanonical(rw, body.toString().getBytes(CHARSET));
 		assertNotNull(c.getObject());
 		assertEquals(treeId, c.getObject().getId());
 		assertSame(rw.lookupTree(treeId), c.getObject());
@@ -213,7 +213,7 @@ private RevTag create(final String msg) throws Exception {
 
 		final RevTag c;
 		c = new RevTag(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
-		c.parseCanonical(new RevWalk(db), b.toString().getBytes(UTF_8));
+		c.parseCanonical(new RevWalk(db), b.toString().getBytes(CHARSET));
 		return c;
 	}
 
@@ -221,17 +221,17 @@ private RevTag create(final String msg) throws Exception {
 	public void testParse_implicit_UTF8_encoded() throws Exception {
 		final ByteArrayOutputStream b = new ByteArrayOutputStream();
 		b.write("object 9788669ad918b6fcce64af8882fc9a81cb6aba67\n"
-				.getBytes(UTF_8));
-		b.write("type tree\n".getBytes(UTF_8));
-		b.write("tag v1.2.3.4.5\n".getBytes(UTF_8));
+				.getBytes(CHARSET));
+		b.write("type tree\n".getBytes(CHARSET));
+		b.write("tag v1.2.3.4.5\n".getBytes(CHARSET));
 
 		b
 				.write("tagger F\u00f6r fattare <a_u_thor@example.com> 1218123387 +0700\n"
-						.getBytes(UTF_8));
-		b.write("\n".getBytes(UTF_8));
-		b.write("Sm\u00f6rg\u00e5sbord\n".getBytes(UTF_8));
-		b.write("\n".getBytes(UTF_8));
-		b.write("\u304d\u308c\u3044\n".getBytes(UTF_8));
+						.getBytes(CHARSET));
+		b.write("\n".getBytes(CHARSET));
+		b.write("Sm\u00f6rg\u00e5sbord\n".getBytes(CHARSET));
+		b.write("\n".getBytes(CHARSET));
+		b.write("\u304d\u308c\u3044\n".getBytes(CHARSET));
 		final RevTag c;
 		c = new RevTag(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
 		c.parseCanonical(new RevWalk(db), b.toByteArray());
@@ -246,15 +246,15 @@ public void testParse_implicit_UTF8_encoded() throws Exception {
 	public void testParse_implicit_mixed_encoded() throws Exception {
 		final ByteArrayOutputStream b = new ByteArrayOutputStream();
 		b.write("object 9788669ad918b6fcce64af8882fc9a81cb6aba67\n"
-				.getBytes(UTF_8));
-		b.write("type tree\n".getBytes(UTF_8));
-		b.write("tag v1.2.3.4.5\n".getBytes(UTF_8));
+				.getBytes(CHARSET));
+		b.write("type tree\n".getBytes(CHARSET));
+		b.write("tag v1.2.3.4.5\n".getBytes(CHARSET));
 		b.write("tagger F\u00f6r fattare <a_u_thor@example.com> 1218123387 +0700\n"
 				.getBytes(ISO_8859_1));
-		b.write("\n".getBytes(UTF_8));
-		b.write("Sm\u00f6rg\u00e5sbord\n".getBytes(UTF_8));
-		b.write("\n".getBytes(UTF_8));
-		b.write("\u304d\u308c\u3044\n".getBytes(UTF_8));
+		b.write("\n".getBytes(CHARSET));
+		b.write("Sm\u00f6rg\u00e5sbord\n".getBytes(CHARSET));
+		b.write("\n".getBytes(CHARSET));
+		b.write("\u304d\u308c\u3044\n".getBytes(CHARSET));
 		final RevTag c;
 		c = new RevTag(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
 		c.parseCanonical(new RevWalk(db), b.toByteArray());
@@ -307,17 +307,17 @@ public void testParse_explicit_encoded() throws Exception {
 	public void testParse_explicit_bad_encoded() throws Exception {
 		final ByteArrayOutputStream b = new ByteArrayOutputStream();
 		b.write("object 9788669ad918b6fcce64af8882fc9a81cb6aba67\n"
-				.getBytes(UTF_8));
-		b.write("type tree\n".getBytes(UTF_8));
-		b.write("tag v1.2.3.4.5\n".getBytes(UTF_8));
+				.getBytes(CHARSET));
+		b.write("type tree\n".getBytes(CHARSET));
+		b.write("tag v1.2.3.4.5\n".getBytes(CHARSET));
 		b
 				.write("tagger F\u00f6r fattare <a_u_thor@example.com> 1218123387 +0700\n"
 						.getBytes(ISO_8859_1));
-		b.write("encoding EUC-JP\n".getBytes(UTF_8));
-		b.write("\n".getBytes(UTF_8));
-		b.write("\u304d\u308c\u3044\n".getBytes(UTF_8));
-		b.write("\n".getBytes(UTF_8));
-		b.write("Hi\n".getBytes(UTF_8));
+		b.write("encoding EUC-JP\n".getBytes(CHARSET));
+		b.write("\n".getBytes(CHARSET));
+		b.write("\u304d\u308c\u3044\n".getBytes(CHARSET));
+		b.write("\n".getBytes(CHARSET));
+		b.write("Hi\n".getBytes(CHARSET));
 		final RevTag c;
 		c = new RevTag(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
 		c.parseCanonical(new RevWalk(db), b.toByteArray());
@@ -342,17 +342,17 @@ public void testParse_explicit_bad_encoded() throws Exception {
 	public void testParse_explicit_bad_encoded2() throws Exception {
 		final ByteArrayOutputStream b = new ByteArrayOutputStream();
 		b.write("object 9788669ad918b6fcce64af8882fc9a81cb6aba67\n"
-				.getBytes(UTF_8));
-		b.write("type tree\n".getBytes(UTF_8));
-		b.write("tag v1.2.3.4.5\n".getBytes(UTF_8));
+				.getBytes(CHARSET));
+		b.write("type tree\n".getBytes(CHARSET));
+		b.write("tag v1.2.3.4.5\n".getBytes(CHARSET));
 		b
 				.write("tagger F\u00f6r fattare <a_u_thor@example.com> 1218123387 +0700\n"
-						.getBytes(UTF_8));
-		b.write("encoding ISO-8859-1\n".getBytes(UTF_8));
-		b.write("\n".getBytes(UTF_8));
-		b.write("\u304d\u308c\u3044\n".getBytes(UTF_8));
-		b.write("\n".getBytes(UTF_8));
-		b.write("Hi\n".getBytes(UTF_8));
+						.getBytes(CHARSET));
+		b.write("encoding ISO-8859-1\n".getBytes(CHARSET));
+		b.write("\n".getBytes(CHARSET));
+		b.write("\u304d\u308c\u3044\n".getBytes(CHARSET));
+		b.write("\n".getBytes(CHARSET));
+		b.write("Hi\n".getBytes(CHARSET));
 		final RevTag c;
 		c = new RevTag(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
 		c.parseCanonical(new RevWalk(db), b.toByteArray());
@@ -365,13 +365,13 @@ public void testParse_explicit_bad_encoded2() throws Exception {
 	@Test
 	public void testParse_illegalEncoding() throws Exception {
 		ByteArrayOutputStream b = new ByteArrayOutputStream();
-		b.write("object 9788669ad918b6fcce64af8882fc9a81cb6aba67\n".getBytes(UTF_8));
-		b.write("type tree\n".getBytes(UTF_8));
-		b.write("tag v1.0\n".getBytes(UTF_8));
-		b.write("tagger t <t@example.com> 1218123387 +0700\n".getBytes(UTF_8));
-		b.write("encoding utf-8logoutputencoding=gbk\n".getBytes(UTF_8));
-		b.write("\n".getBytes(UTF_8));
-		b.write("message\n".getBytes(UTF_8));
+		b.write("object 9788669ad918b6fcce64af8882fc9a81cb6aba67\n".getBytes(CHARSET));
+		b.write("type tree\n".getBytes(CHARSET));
+		b.write("tag v1.0\n".getBytes(CHARSET));
+		b.write("tagger t <t@example.com> 1218123387 +0700\n".getBytes(CHARSET));
+		b.write("encoding utf-8logoutputencoding=gbk\n".getBytes(CHARSET));
+		b.write("\n".getBytes(CHARSET));
+		b.write("message\n".getBytes(CHARSET));
 
 		RevTag t = new RevTag(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
 		t.parseCanonical(new RevWalk(db), b.toByteArray());
@@ -384,13 +384,13 @@ public void testParse_illegalEncoding() throws Exception {
 	@Test
 	public void testParse_unsupportedEncoding() throws Exception {
 		ByteArrayOutputStream b = new ByteArrayOutputStream();
-		b.write("object 9788669ad918b6fcce64af8882fc9a81cb6aba67\n".getBytes(UTF_8));
-		b.write("type tree\n".getBytes(UTF_8));
-		b.write("tag v1.0\n".getBytes(UTF_8));
-		b.write("tagger t <t@example.com> 1218123387 +0700\n".getBytes(UTF_8));
-		b.write("encoding it_IT.UTF8\n".getBytes(UTF_8));
-		b.write("\n".getBytes(UTF_8));
-		b.write("message\n".getBytes(UTF_8));
+		b.write("object 9788669ad918b6fcce64af8882fc9a81cb6aba67\n".getBytes(CHARSET));
+		b.write("type tree\n".getBytes(CHARSET));
+		b.write("tag v1.0\n".getBytes(CHARSET));
+		b.write("tagger t <t@example.com> 1218123387 +0700\n".getBytes(CHARSET));
+		b.write("encoding it_IT.UTF8\n".getBytes(CHARSET));
+		b.write("\n".getBytes(CHARSET));
+		b.write("message\n".getBytes(CHARSET));
 
 		RevTag t = new RevTag(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
 		t.parseCanonical(new RevWalk(db), b.toByteArray());
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileBasedConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileBasedConfigTest.java
index 7f0d602..0dea5ce 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileBasedConfigTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileBasedConfigTest.java
@@ -42,7 +42,7 @@
  */
 package org.eclipse.jgit.storage.file;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.eclipse.jgit.util.FileUtils.pathToString;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
@@ -105,7 +105,7 @@ public void testSystemEncoding() throws IOException, ConfigInvalidException {
 
 	@Test
 	public void testUTF8withoutBOM() throws IOException, ConfigInvalidException {
-		final File file = createFile(CONTENT1.getBytes(UTF_8));
+		final File file = createFile(CONTENT1.getBytes(CHARSET));
 		final FileBasedConfig config = new FileBasedConfig(file, FS.DETECTED);
 		config.load();
 		assertEquals(ALICE, config.getString(USER, null, NAME));
@@ -121,7 +121,7 @@ public void testUTF8withBOM() throws IOException, ConfigInvalidException {
 		bos1.write(0xEF);
 		bos1.write(0xBB);
 		bos1.write(0xBF);
-		bos1.write(CONTENT1.getBytes(UTF_8));
+		bos1.write(CONTENT1.getBytes(CHARSET));
 
 		final File file = createFile(bos1.toByteArray());
 		final FileBasedConfig config = new FileBasedConfig(file, FS.DETECTED);
@@ -135,7 +135,7 @@ public void testUTF8withBOM() throws IOException, ConfigInvalidException {
 		bos2.write(0xEF);
 		bos2.write(0xBB);
 		bos2.write(0xBF);
-		bos2.write(CONTENT2.getBytes(UTF_8));
+		bos2.write(CONTENT2.getBytes(CHARSET));
 		assertArrayEquals(bos2.toByteArray(), IO.readFully(file));
 	}
 
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java
index 658b971..d30ac84 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java
@@ -45,7 +45,7 @@
 
 package org.eclipse.jgit.transport;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.eclipse.jgit.lib.Constants.OBJ_BLOB;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -199,7 +199,7 @@ public void testCustomObjectReader() throws Exception {
 			Ref ref = repo.exactRef(refName);
 			assertNotNull(ref);
 			assertEquals(id, ref.getObjectId());
-			assertEquals(data, new String(repo.open(id, OBJ_BLOB).getBytes(), UTF_8));
+			assertEquals(data, new String(repo.open(id, OBJ_BLOB).getBytes(), CHARSET));
 		}
 	}
 
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java
index cb04f83..2251a3d 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.transport;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.eclipse.jgit.transport.WalkEncryptionTest.Util.cryptoCipherListPBE;
 import static org.eclipse.jgit.transport.WalkEncryptionTest.Util.cryptoCipherListTrans;
 import static org.eclipse.jgit.transport.WalkEncryptionTest.Util.folderDelete;
@@ -360,7 +360,7 @@ static class Util {
 		 * @throws Exception
 		 */
 		static String textRead(File file) throws Exception {
-			return new String(Files.readAllBytes(file.toPath()), UTF_8);
+			return new String(Files.readAllBytes(file.toPath()), CHARSET);
 		}
 
 		/**
@@ -371,7 +371,7 @@ static String textRead(File file) throws Exception {
 		 * @throws Exception
 		 */
 		static void textWrite(File file, String text) throws Exception {
-			Files.write(file.toPath(), text.getBytes(UTF_8));
+			Files.write(file.toPath(), text.getBytes(CHARSET));
 		}
 
 		static void verifyFileContent(File fileOne, File fileTwo)
@@ -741,7 +741,7 @@ static void remoteVerify() throws Exception {
 			AmazonS3 s3 = new AmazonS3(props);
 			String file = JGIT_USER + "-" + UUID.randomUUID().toString();
 			String path = JGIT_REMOTE_DIR + "/" + file;
-			s3.put(bucket, path, file.getBytes(UTF_8));
+			s3.put(bucket, path, file.getBytes(CHARSET));
 			s3.delete(bucket, path);
 		}
 
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RawSubStringPatternTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RawSubStringPatternTest.java
index e8566d2..a748b52 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RawSubStringPatternTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RawSubStringPatternTest.java
@@ -42,7 +42,7 @@
  */
 package org.eclipse.jgit.util;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
@@ -93,7 +93,7 @@ private static void assertMatchResult(String pattern, String input, int position
 	}
 
 	private static RawCharSequence raw(String text) {
-		byte[] bytes = text.getBytes(UTF_8);
+		byte[] bytes = text.getBytes(CHARSET);
 		return new RawCharSequence(bytes, 0, bytes.length);
 	}
 }
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/AutoLFInputStreamTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/AutoLFInputStreamTest.java
index 38199d8..8b955ba 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/AutoLFInputStreamTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/AutoLFInputStreamTest.java
@@ -44,7 +44,7 @@
 
 package org.eclipse.jgit.util.io;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.junit.Assert.assertEquals;
 
 import java.io.ByteArrayInputStream;
@@ -129,6 +129,6 @@ private static void test(byte[] input, byte[] expected,
 	}
 
 	private static byte[] asBytes(String in) {
-		return in.getBytes(UTF_8);
+		return in.getBytes(CHARSET);
 	}
 }
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/sha1/SHA1Test.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/sha1/SHA1Test.java
index e6045a9..3c612e1 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/sha1/SHA1Test.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/sha1/SHA1Test.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.util.sha1;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -95,15 +95,15 @@ public void test1() throws NoSuchAlgorithmException {
 				.fromString("a9993e364706816aba3e25717850c26c9cd0d89d");
 
 		MessageDigest m = MessageDigest.getInstance("SHA-1");
-		m.update(TEST1.getBytes(UTF_8));
+		m.update(TEST1.getBytes(CHARSET));
 		ObjectId m1 = ObjectId.fromRaw(m.digest());
 
 		SHA1 s = SHA1.newInstance();
-		s.update(TEST1.getBytes(UTF_8));
+		s.update(TEST1.getBytes(CHARSET));
 		ObjectId s1 = ObjectId.fromRaw(s.digest());
 
 		s.reset();
-		s.update(TEST1.getBytes(UTF_8));
+		s.update(TEST1.getBytes(CHARSET));
 		ObjectId s2 = s.toObjectId();
 
 		assertEquals(m1, s1);
@@ -117,15 +117,15 @@ public void test2() throws NoSuchAlgorithmException {
 				.fromString("84983e441c3bd26ebaae4aa1f95129e5e54670f1");
 
 		MessageDigest m = MessageDigest.getInstance("SHA-1");
-		m.update(TEST2.getBytes(UTF_8));
+		m.update(TEST2.getBytes(CHARSET));
 		ObjectId m1 = ObjectId.fromRaw(m.digest());
 
 		SHA1 s = SHA1.newInstance();
-		s.update(TEST2.getBytes(UTF_8));
+		s.update(TEST2.getBytes(CHARSET));
 		ObjectId s1 = ObjectId.fromRaw(s.digest());
 
 		s.reset();
-		s.update(TEST2.getBytes(UTF_8));
+		s.update(TEST2.getBytes(CHARSET));
 		ObjectId s2 = s.toObjectId();
 
 		assertEquals(m1, s1);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/hooks/GitHook.java b/org.eclipse.jgit/src/org/eclipse/jgit/hooks/GitHook.java
index ad43e2c..8a61d1b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/hooks/GitHook.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/hooks/GitHook.java
@@ -42,7 +42,7 @@
  */
 package org.eclipse.jgit.hooks;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -158,7 +158,7 @@ protected void doRun() throws AbortedByHookException {
 		PrintStream hookErrRedirect = null;
 		try {
 			hookErrRedirect = new PrintStream(errorByteArray, false,
-					UTF_8.name());
+					CHARSET.name());
 		} catch (UnsupportedEncodingException e) {
 			// UTF-8 is guaranteed to be available
 		}
@@ -167,7 +167,7 @@ protected void doRun() throws AbortedByHookException {
 				hookErrRedirect, getStdinArgs());
 		if (result.isExecutedWithError()) {
 			throw new AbortedByHookException(
-					new String(errorByteArray.toByteArray(), UTF_8),
+					new String(errorByteArray.toByteArray(), CHARSET),
 					getHookName(), result.getExitCode());
 		}
 	}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsStreamKey.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsStreamKey.java
index 8793d83..c11f696 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsStreamKey.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsStreamKey.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.internal.storage.dfs;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 
 import java.util.Arrays;
 
@@ -67,7 +67,7 @@ public abstract class DfsStreamKey {
 	 */
 	public static DfsStreamKey of(DfsRepositoryDescription repo, String name,
 			@Nullable PackExt ext) {
-		return new ByteArrayDfsStreamKey(repo, name.getBytes(UTF_8), ext);
+		return new ByteArrayDfsStreamKey(repo, name.getBytes(CHARSET), ext);
 	}
 
 	final int hash;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GcLog.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GcLog.java
index bca7076..c159a94 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GcLog.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GcLog.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.internal.storage.file;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -187,6 +187,6 @@ void write(String content) throws IOException {
 		if (content.length() > 0) {
 			nonEmpty = true;
 		}
-		lock.write(content.getBytes(UTF_8));
+		lock.write(content.getBytes(CHARSET));
 	}
 }
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LazyObjectIdSetFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LazyObjectIdSetFile.java
index 3d0e9c7..c82d52e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LazyObjectIdSetFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LazyObjectIdSetFile.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.internal.storage.file;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -86,7 +86,7 @@ public boolean contains(AnyObjectId objectId) {
 	private ObjectIdOwnerMap<Entry> load() {
 		ObjectIdOwnerMap<Entry> r = new ObjectIdOwnerMap<>();
 		try (FileInputStream fin = new FileInputStream(src);
-				Reader rin = new InputStreamReader(fin, UTF_8);
+				Reader rin = new InputStreamReader(fin, CHARSET);
 				BufferedReader br = new BufferedReader(rin)) {
 			MutableObjectId id = new MutableObjectId();
 			for (String line; (line = br.readLine()) != null;) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/BlockReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/BlockReader.java
index ce2ba4a..942d72f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/BlockReader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/BlockReader.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.internal.storage.reftable;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.eclipse.jgit.internal.storage.reftable.BlockWriter.compare;
 import static org.eclipse.jgit.internal.storage.reftable.ReftableConstants.FILE_BLOCK_TYPE;
 import static org.eclipse.jgit.internal.storage.reftable.ReftableConstants.FILE_HEADER_LEN;
@@ -138,7 +138,7 @@ String name() {
 		if (blockType == LOG_BLOCK_TYPE) {
 			len -= 9;
 		}
-		return RawParseUtils.decode(UTF_8, nameBuf, 0, len);
+		return RawParseUtils.decode(CHARSET, nameBuf, 0, len);
 	}
 
 	boolean match(byte[] match, boolean matchIsPrefix) {
@@ -171,7 +171,7 @@ long readUpdateIndexDelta() {
 	}
 
 	Ref readRef() throws IOException {
-		String name = RawParseUtils.decode(UTF_8, nameBuf, 0, nameLen);
+		String name = RawParseUtils.decode(CHARSET, nameBuf, 0, nameLen);
 		switch (valueType & VALUE_TYPE_MASK) {
 		case VALUE_NONE: // delete
 			return newRef(name);
@@ -266,7 +266,7 @@ private ObjectId readValueId() {
 	private String readValueString() {
 		int len = readVarint32();
 		int end = ptr + len;
-		String s = RawParseUtils.decode(UTF_8, buf, ptr, end);
+		String s = RawParseUtils.decode(CHARSET, buf, ptr, end);
 		ptr = end;
 		return s;
 	}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/BlockWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/BlockWriter.java
index b3173e8..3d8fbf4 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/BlockWriter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/BlockWriter.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.internal.storage.reftable;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.eclipse.jgit.internal.storage.reftable.ReftableConstants.FILE_HEADER_LEN;
 import static org.eclipse.jgit.internal.storage.reftable.ReftableConstants.INDEX_BLOCK_TYPE;
 import static org.eclipse.jgit.internal.storage.reftable.ReftableConstants.LOG_BLOCK_TYPE;
@@ -440,7 +440,7 @@ void writeValue(ReftableOutputStream os) throws IOException {
 		}
 
 		private static byte[] nameUtf8(Ref ref) {
-			return ref.getName().getBytes(UTF_8);
+			return ref.getName().getBytes(CHARSET);
 		}
 	}
 
@@ -559,13 +559,13 @@ static class LogEntry extends Entry {
 			this.newId = newId;
 			this.timeSecs = who.getWhen().getTime() / 1000L;
 			this.tz = (short) who.getTimeZoneOffset();
-			this.name = who.getName().getBytes(UTF_8);
-			this.email = who.getEmailAddress().getBytes(UTF_8);
-			this.msg = message.getBytes(UTF_8);
+			this.name = who.getName().getBytes(CHARSET);
+			this.email = who.getEmailAddress().getBytes(CHARSET);
+			this.msg = message.getBytes(CHARSET);
 		}
 
 		static byte[] key(String ref, long index) {
-			byte[] name = ref.getBytes(UTF_8);
+			byte[] name = ref.getBytes(CHARSET);
 			byte[] key = Arrays.copyOf(name, name.length + 1 + 8);
 			NB.encodeInt64(key, key.length - 8, reverseUpdateIndex(index));
 			return key;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableOutputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableOutputStream.java
index 1fc43c9..44bbb16 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableOutputStream.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableOutputStream.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.internal.storage.reftable;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.eclipse.jgit.internal.storage.reftable.ReftableConstants.FILE_HEADER_LEN;
 import static org.eclipse.jgit.internal.storage.reftable.ReftableConstants.INDEX_BLOCK_TYPE;
 import static org.eclipse.jgit.internal.storage.reftable.ReftableConstants.LOG_BLOCK_TYPE;
@@ -160,7 +160,7 @@ void writeId(ObjectId id) {
 	}
 
 	void writeVarintString(String s) {
-		writeVarintString(s.getBytes(UTF_8));
+		writeVarintString(s.getBytes(CHARSET));
 	}
 
 	void writeVarintString(byte[] msg) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableReader.java
index 7487719..5356952 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableReader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableReader.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.internal.storage.reftable;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.eclipse.jgit.internal.storage.reftable.BlockReader.decodeBlockLen;
 import static org.eclipse.jgit.internal.storage.reftable.ReftableConstants.FILE_BLOCK_TYPE;
 import static org.eclipse.jgit.internal.storage.reftable.ReftableConstants.FILE_FOOTER_LEN;
@@ -182,7 +182,7 @@ public RefCursor allRefs() throws IOException {
 	public RefCursor seekRef(String refName) throws IOException {
 		initRefIndex();
 
-		byte[] key = refName.getBytes(UTF_8);
+		byte[] key = refName.getBytes(CHARSET);
 		boolean prefix = key[key.length - 1] == '/';
 
 		RefCursorImpl i = new RefCursorImpl(refEnd, key, prefix);
@@ -223,7 +223,7 @@ public LogCursor seekLog(String refName, long updateIndex)
 		initLogIndex();
 		if (logPosition > 0) {
 			byte[] key = LogEntry.key(refName, updateIndex);
-			byte[] match = refName.getBytes(UTF_8);
+			byte[] match = refName.getBytes(CHARSET);
 			LogCursorImpl i = new LogCursorImpl(logEnd, match);
 			i.block = seek(LOG_BLOCK_TYPE, key, logIndex, logPosition, logEnd);
 			return i;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BlobBasedConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BlobBasedConfig.java
index 3ff92dc..f44aece 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BlobBasedConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BlobBasedConfig.java
@@ -45,6 +45,8 @@
 
 package org.eclipse.jgit.lib;
 
+import static org.eclipse.jgit.lib.Constants.CHARSET;
+
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.text.MessageFormat;
@@ -81,8 +83,7 @@ public BlobBasedConfig(Config base, final byte[] blob)
 		super(base);
 		final String decoded;
 		if (isUtf8(blob)) {
-			decoded = RawParseUtils.decode(RawParseUtils.UTF8_CHARSET,
-					blob, 3, blob.length);
+			decoded = RawParseUtils.decode(CHARSET, blob, 3, blob.length);
 		} else {
 			decoded = RawParseUtils.decode(blob);
 		}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java
index 4d558c9..285a56c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java
@@ -51,6 +51,8 @@
 
 package org.eclipse.jgit.lib;
 
+import static org.eclipse.jgit.lib.Constants.CHARSET;
+
 import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -1166,8 +1168,7 @@ private void addIncludedConfig(final List<ConfigLine> newEntries,
 
 		String decoded;
 		if (isUtf8(bytes)) {
-			decoded = RawParseUtils.decode(RawParseUtils.UTF8_CHARSET, bytes, 3,
-					bytes.length);
+			decoded = RawParseUtils.decode(CHARSET, bytes, 3, bytes.length);
 		} else {
 			decoded = RawParseUtils.decode(bytes);
 		}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java
index 29189a9..5c7cee6 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java
@@ -228,10 +228,10 @@ public final class Constants {
 	public static final byte[] PACK_SIGNATURE = { 'P', 'A', 'C', 'K' };
 
 	/** Native character encoding for commit messages, file names... */
-	public static final Charset CHARSET = UTF_8;
+	public static final Charset CHARSET;
 
 	/** Native character encoding for commit messages, file names... */
-	public static final String CHARACTER_ENCODING = CHARSET.name();
+	public static final String CHARACTER_ENCODING;
 
 	/** Default main branch name */
 	public static final String MASTER = "master";
@@ -654,6 +654,8 @@ public static int decodeTypeString(final AnyObjectId id,
 	static {
 		if (OBJECT_ID_LENGTH != newMessageDigest().getDigestLength())
 			throw new LinkageError(JGitText.get().incorrectOBJECT_ID_LENGTH);
+		CHARSET = UTF_8;
+		CHARACTER_ENCODING = CHARSET.name();
 	}
 
 	/** name of the file containing the commit msg for a merge commit */
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java
index 06b4b22..3871605 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.lib;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 
 import java.io.BufferedOutputStream;
 import java.io.File;
@@ -183,7 +183,7 @@ private static RebaseTodoLine parseLine(byte[] buf, int tokenBegin,
 			switch (tokenCount) {
 			case 0:
 				String actionToken = new String(buf, tokenBegin,
-						nextSpace - tokenBegin - 1, UTF_8);
+						nextSpace - tokenBegin - 1, CHARSET);
 				tokenBegin = nextSpace;
 				action = RebaseTodoLine.Action.parse(actionToken);
 				if (action == null)
@@ -192,7 +192,7 @@ private static RebaseTodoLine parseLine(byte[] buf, int tokenBegin,
 			case 1:
 				nextSpace = RawParseUtils.next(buf, tokenBegin, ' ');
 				String commitToken = new String(buf, tokenBegin,
-						nextSpace - tokenBegin - 1, UTF_8);
+						nextSpace - tokenBegin - 1, CHARSET);
 				tokenBegin = nextSpace;
 				commit = AbbreviatedObjectId.fromString(commitToken);
 				break;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/TextProgressMonitor.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/TextProgressMonitor.java
index 936ce3d..2f759e5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/TextProgressMonitor.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/TextProgressMonitor.java
@@ -44,7 +44,7 @@
 
 package org.eclipse.jgit.lib;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 
 import java.io.IOException;
 import java.io.OutputStreamWriter;
@@ -63,7 +63,7 @@ public class TextProgressMonitor extends BatchingProgressMonitor {
 	 * Initialize a new progress monitor.
 	 */
 	public TextProgressMonitor() {
-		this(new PrintWriter(new OutputStreamWriter(System.err, UTF_8)));
+		this(new PrintWriter(new OutputStreamWriter(System.err, CHARSET)));
 	}
 
 	/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java
index 9db1467..5c8371f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java
@@ -44,7 +44,7 @@
 
 package org.eclipse.jgit.revwalk;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 
 import java.io.IOException;
 import java.nio.charset.Charset;
@@ -539,7 +539,7 @@ private Charset guessEncoding() {
 		try {
 			return getEncoding();
 		} catch (IllegalCharsetNameException | UnsupportedCharsetException e) {
-			return UTF_8;
+			return CHARSET;
 		}
 	}
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevTag.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevTag.java
index d74837e..cbeda71 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevTag.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevTag.java
@@ -45,7 +45,7 @@
 
 package org.eclipse.jgit.revwalk;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 
 import java.io.IOException;
 import java.nio.charset.Charset;
@@ -169,7 +169,7 @@ void parseCanonical(final RevWalk walk, final byte[] rawTag)
 
 		int p = pos.value += 4; // "tag "
 		final int nameEnd = RawParseUtils.nextLF(rawTag, p) - 1;
-		tagName = RawParseUtils.decode(UTF_8, rawTag, p, nameEnd);
+		tagName = RawParseUtils.decode(CHARSET, rawTag, p, nameEnd);
 
 		if (walk.isRetainBody())
 			buffer = rawTag;
@@ -257,7 +257,7 @@ private Charset guessEncoding() {
 		try {
 			return RawParseUtils.parseEncoding(buffer);
 		} catch (IllegalCharsetNameException | UnsupportedCharsetException e) {
-			return UTF_8;
+			return CHARSET;
 		}
 	}
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileBasedConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileBasedConfig.java
index 9927daf..93ffb94 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileBasedConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileBasedConfig.java
@@ -49,6 +49,8 @@
 
 package org.eclipse.jgit.storage.file;
 
+import static org.eclipse.jgit.lib.Constants.CHARSET;
+
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -154,7 +156,7 @@ public void load() throws IOException, ConfigInvalidException {
 			} else {
 				final String decoded;
 				if (isUtf8(in)) {
-					decoded = RawParseUtils.decode(RawParseUtils.UTF8_CHARSET,
+					decoded = RawParseUtils.decode(CHARSET,
 							in, 3, in.length);
 					utf8Bom = true;
 				} else {
@@ -198,7 +200,7 @@ public void save() throws IOException {
 			bos.write(0xEF);
 			bos.write(0xBB);
 			bos.write(0xBF);
-			bos.write(text.getBytes(RawParseUtils.UTF8_CHARSET.name()));
+			bos.write(text.getBytes(CHARSET));
 			out = bos.toByteArray();
 		} else {
 			out = Constants.encode(text);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
index d7c5b9d..71e3d16 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.transport;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
@@ -638,7 +638,7 @@ void authorize(final HttpURLConnection c) throws IOException {
 		try {
 			final Mac m = Mac.getInstance(HMAC);
 			m.init(privateKey);
-			sec = Base64.encodeBytes(m.doFinal(s.toString().getBytes(UTF_8)));
+			sec = Base64.encodeBytes(m.doFinal(s.toString().getBytes(CHARSET)));
 		} catch (NoSuchAlgorithmException e) {
 			throw new IOException(MessageFormat.format(JGitText.get().noHMACsupport, HMAC, e.getMessage()));
 		} catch (InvalidKeyException e) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HMACSHA1NonceGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HMACSHA1NonceGenerator.java
index 6c26b70..1415334 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HMACSHA1NonceGenerator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HMACSHA1NonceGenerator.java
@@ -43,7 +43,7 @@
 package org.eclipse.jgit.transport;
 
 import static java.nio.charset.StandardCharsets.ISO_8859_1;
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 
 import java.io.File;
 import java.security.InvalidKeyException;
@@ -102,7 +102,7 @@ public synchronized String createNonce(Repository repo, long timestamp)
 		}
 
 		String input = path + ":" + String.valueOf(timestamp); //$NON-NLS-1$
-		byte[] rawHmac = mac.doFinal(input.getBytes(UTF_8));
+		byte[] rawHmac = mac.doFinal(input.getBytes(CHARSET));
 		return Long.toString(timestamp) + "-" + toHex(rawHmac); //$NON-NLS-1$
 	}
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java
index c40d963..de7a7dc 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.transport;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.eclipse.jgit.util.HttpSupport.HDR_AUTHORIZATION;
 import static org.eclipse.jgit.util.HttpSupport.HDR_WWW_AUTHENTICATE;
 
@@ -315,7 +315,7 @@ void authorize(final String username, final String password) {
 		@Override
 		void configureRequest(final HttpConnection conn) throws IOException {
 			String ident = user + ":" + pass; //$NON-NLS-1$
-			String enc = Base64.encodeBytes(ident.getBytes(UTF_8));
+			String enc = Base64.encodeBytes(ident.getBytes(CHARSET));
 			conn.setRequestProperty(HDR_AUTHORIZATION, type.getSchemeName()
 					+ " " + enc); //$NON-NLS-1$
 		}
@@ -430,15 +430,15 @@ private static String uri(URL u) {
 
 		private static String H(String data) {
 			MessageDigest md = newMD5();
-			md.update(data.getBytes(UTF_8));
+			md.update(data.getBytes(CHARSET));
 			return LHEX(md.digest());
 		}
 
 		private static String KD(String secret, String data) {
 			MessageDigest md = newMD5();
-			md.update(secret.getBytes(UTF_8));
+			md.update(secret.getBytes(CHARSET));
 			md.update((byte) ':');
-			md.update(data.getBytes(UTF_8));
+			md.update(data.getBytes(CHARSET));
 			return LHEX(md.digest());
 		}
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ProgressSpinner.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ProgressSpinner.java
index 41af807..2364434 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ProgressSpinner.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ProgressSpinner.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.transport;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 
 import java.io.IOException;
 import java.io.OutputStream;
@@ -141,7 +141,7 @@ public void endTask(String result) {
 	private void write(String s) {
 		if (write) {
 			try {
-				out.write(s.getBytes(UTF_8));
+				out.write(s.getBytes(CHARSET));
 				out.flush();
 			} catch (IOException e) {
 				write = false;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateIdent.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateIdent.java
index f9fddbe..178c80d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateIdent.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateIdent.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.transport;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.eclipse.jgit.util.RawParseUtils.lastIndexOfTrim;
 
 import java.text.SimpleDateFormat;
@@ -95,7 +95,7 @@ public class PushCertificateIdent {
 	 */
 	public static PushCertificateIdent parse(String str) {
 		MutableInteger p = new MutableInteger();
-		byte[] raw = str.getBytes(UTF_8);
+		byte[] raw = str.getBytes(CHARSET);
 		int tzBegin = raw.length - 1;
 		tzBegin = lastIndexOfTrim(raw, ' ', tzBegin);
 		if (tzBegin < 0 || raw[tzBegin] != ' ') {
@@ -129,7 +129,7 @@ public static PushCertificateIdent parse(String str) {
 				idEnd = raw.length;
 			}
 		}
-		String id = new String(raw, 0, idEnd, UTF_8);
+		String id = new String(raw, 0, idEnd, CHARSET);
 
 		return new PushCertificateIdent(str, id, when * 1000L, tz);
 	}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateStore.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateStore.java
index ab58a33..36d6602 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateStore.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateStore.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.transport;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.eclipse.jgit.lib.Constants.OBJ_BLOB;
 import static org.eclipse.jgit.lib.Constants.OBJ_COMMIT;
 import static org.eclipse.jgit.lib.FileMode.TYPE_FILE;
@@ -292,7 +292,7 @@ static PushCertificate read(TreeWalk tw) throws IOException {
 		ObjectLoader loader =
 				tw.getObjectReader().open(tw.getObjectId(0), OBJ_BLOB);
 		try (InputStream in = loader.openStream();
-				Reader r = new BufferedReader(new InputStreamReader(in, UTF_8))) {
+				Reader r = new BufferedReader(new InputStreamReader(in, CHARSET))) {
 			return PushCertificateParser.fromReader(r);
 		}
 	}
@@ -473,7 +473,7 @@ private ObjectId saveCert(ObjectInserter inserter, DirCache dc,
 
 		DirCacheEditor editor = dc.editor();
 		String certText = pc.cert.toText() + pc.cert.getSignature();
-		final ObjectId certId = inserter.insert(OBJ_BLOB, certText.getBytes(UTF_8));
+		final ObjectId certId = inserter.insert(OBJ_BLOB, certText.getBytes(CHARSET));
 		boolean any = false;
 		for (ReceiveCommand cmd : pc.cert.getCommands()) {
 			if (byRef != null && !commandsEqual(cmd, byRef.get(cmd.getRefName()))) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java
index 5eb1661..6ad39e3 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java
@@ -43,7 +43,7 @@
 
 package org.eclipse.jgit.transport;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.eclipse.jgit.lib.Constants.OBJECT_ID_STRING_LENGTH;
 import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_SYMREF;
 
@@ -74,7 +74,7 @@
 public abstract class RefAdvertiser {
 	/** Advertiser which frames lines in a {@link PacketLineOut} format. */
 	public static class PacketLineOutRefAdvertiser extends RefAdvertiser {
-		private final CharsetEncoder utf8 = UTF_8.newEncoder();
+		private final CharsetEncoder utf8 = CHARSET.newEncoder();
 		private final PacketLineOut pckOut;
 
 		private byte[] binArr = new byte[256];
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java
index 8db796a..ce321b0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java
@@ -46,6 +46,7 @@
 
 package org.eclipse.jgit.transport;
 
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 import static org.eclipse.jgit.lib.RefDatabase.ALL;
 
 import java.io.BufferedReader;
@@ -147,7 +148,7 @@ private static void scan(ClassLoader ldr, URL url) {
 		BufferedReader br;
 		try {
 			InputStream urlIn = url.openStream();
-			br = new BufferedReader(new InputStreamReader(urlIn, "UTF-8")); //$NON-NLS-1$
+			br = new BufferedReader(new InputStreamReader(urlIn, CHARSET));
 		} catch (IOException err) {
 			// If we cannot read from the service list, go to the next.
 			//
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java
index 0c27ced..442f079 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java
@@ -6,9 +6,8 @@
 
 package org.eclipse.jgit.util;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.Constants.CHARSET;
 
-import java.nio.charset.StandardCharsets;
 import java.text.MessageFormat;
 import java.util.Arrays;
 
@@ -55,7 +54,7 @@ public class Base64 {
 				+ "abcdefghijklmnopqrstuvwxyz" // //$NON-NLS-1$
 				+ "0123456789" // //$NON-NLS-1$
 				+ "+/" // //$NON-NLS-1$
-		).getBytes(UTF_8);
+		).getBytes(CHARSET);
 
 		DEC = new byte[128];
 		Arrays.fill(DEC, INVALID_DEC);
@@ -178,7 +177,7 @@ public static String encodeBytes(byte[] source, int off, int len) {
 			e += 4;
 		}
 
-		return new String(outBuff, 0, e, StandardCharsets.UTF_8);
+		return new String(outBuff, 0, e, CHARSET);
 	}
 
 	/**
@@ -294,7 +293,7 @@ else if (source[srcOffset + 3] == EQUALS_SIGN) {
 	 * @return the decoded data
 	 */
 	public static byte[] decode(String s) {
-		byte[] bytes = s.getBytes(UTF_8);
+		byte[] bytes = s.getBytes(CHARSET);
 		return decode(bytes, 0, bytes.length);
 	}
 }
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java
index 64cdcc3..0b0a505 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java
@@ -43,6 +43,8 @@
 
 package org.eclipse.jgit.util;
 
+import static org.eclipse.jgit.lib.Constants.CHARSET;
+
 import java.io.File;
 import java.io.PrintStream;
 import java.nio.file.Files;
@@ -124,7 +126,7 @@ public File resolve(final File dir, final String pn) {
 			try {
 				w = readPipe(dir, //
 					new String[] { cygpath, "--windows", "--absolute", pn }, // //$NON-NLS-1$ //$NON-NLS-2$
-					"UTF-8"); //$NON-NLS-1$
+					CHARSET.name());
 			} catch (CommandFailedException e) {
 				LOG.warn(e.getMessage());
 				return null;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java
index a5a858f..d070ed3 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java
@@ -44,6 +44,8 @@
 
 package org.eclipse.jgit.util;
 
+import static org.eclipse.jgit.lib.Constants.CHARACTER_ENCODING;
+
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.net.ConnectException;
@@ -179,7 +181,7 @@ public static void encode(final StringBuilder urlstr, final String key) {
 		if (key == null || key.length() == 0)
 			return;
 		try {
-			urlstr.append(URLEncoder.encode(key, "UTF-8")); //$NON-NLS-1$
+			urlstr.append(URLEncoder.encode(key, CHARACTER_ENCODING));
 		} catch (UnsupportedEncodingException e) {
 			throw new RuntimeException(JGitText.get().couldNotURLEncodeToUTF8, e);
 		}