Specify UTF-8 instead of platform default charset

Implicit use of the platform default charset can result in
e.g. non-ASCII characters being silently replaced with '?'
in many environments.

Change-Id: Ibc2d9177f4a1638bcc9830eccba6012e41ebaabd
This commit is contained in:
Andrew Bonventre
2016-09-03 22:44:06 -04:00
parent 326cc9ae67
commit 69ebca7052

View File

@@ -14,6 +14,8 @@
package com.google.gerrit.server.patch;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.gerrit.common.errors.NoSuchEntityException;
import com.google.gerrit.reviewdb.client.Patch;
@@ -151,7 +153,7 @@ public class PatchFile {
return new Text(repo.open(tw.getObjectId(0), Constants.OBJ_BLOB));
} else if (tw.getFileMode(0).getObjectType() == Constants.OBJ_COMMIT) {
String str = "Subproject commit " + ObjectId.toString(tw.getObjectId(0));
return new Text(str.getBytes());
return new Text(str.getBytes(UTF_8));
} else {
return Text.EMPTY;
}