Don't rely on platform default encoding, which can lead to inconsistent results on different platforms
This commit is contained in:
@@ -42,6 +42,7 @@ import com.threerings.getdown.util.*;
|
||||
import com.threerings.getdown.util.Base64;
|
||||
|
||||
import static com.threerings.getdown.Log.log;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
/**
|
||||
* Parses and provide access to the information contained in the <code>getdown.txt</code>
|
||||
@@ -1242,7 +1243,7 @@ public class Application
|
||||
|
||||
if (_latest != null) {
|
||||
try (InputStream in = ConnectionUtil.open(_latest, 0, 0).getInputStream();
|
||||
InputStreamReader reader = new InputStreamReader(in);
|
||||
InputStreamReader reader = new InputStreamReader(in, UTF_8);
|
||||
BufferedReader bin = new BufferedReader(reader)) {
|
||||
for (String[] pair : Config.parsePairs(bin, Config.createOpts(false))) {
|
||||
if (pair[0].equals("version")) {
|
||||
|
||||
@@ -9,7 +9,6 @@ import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintStream;
|
||||
@@ -20,6 +19,7 @@ import com.samskivert.util.StringUtil;
|
||||
|
||||
import com.threerings.getdown.data.SysProps;
|
||||
import static com.threerings.getdown.Log.log;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
/**
|
||||
* Version related utilities.
|
||||
@@ -33,7 +33,7 @@ public class VersionUtil
|
||||
{
|
||||
long fileVersion = -1;
|
||||
try (BufferedReader bin =
|
||||
new BufferedReader(new InputStreamReader(new FileInputStream(vfile)))) {
|
||||
new BufferedReader(new InputStreamReader(new FileInputStream(vfile), UTF_8))) {
|
||||
String vstr = bin.readLine();
|
||||
if (!StringUtil.isBlank(vstr)) {
|
||||
fileVersion = Long.parseLong(vstr);
|
||||
@@ -81,7 +81,8 @@ public class VersionUtil
|
||||
*/
|
||||
public static long readReleaseVersion (File relfile, String versRegex)
|
||||
{
|
||||
try (BufferedReader in = new BufferedReader(new FileReader(relfile))) {
|
||||
try (BufferedReader in =
|
||||
new BufferedReader(new InputStreamReader(new FileInputStream(relfile), UTF_8))) {
|
||||
String line = null, relvers = null;
|
||||
while ((line = in.readLine()) != null) {
|
||||
if (line.startsWith("JAVA_VERSION=")) {
|
||||
|
||||
Reference in New Issue
Block a user