mirror of
https://github.com/Qortal/qortal.git
synced 2025-06-03 23:16:58 +00:00
Set charset to UTF-8 in various places that bytes are converted to a string.
This commit is contained in:
parent
45bc2e46d6
commit
6dfaaf0054
@ -9,6 +9,7 @@ import java.io.BufferedWriter;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
|
||||||
@ -75,7 +76,7 @@ public class ArbitraryDataMetadata {
|
|||||||
throw new IOException(String.format("Metadata file doesn't exist: %s", this.filePath.toString()));
|
throw new IOException(String.format("Metadata file doesn't exist: %s", this.filePath.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.jsonString = new String(Files.readAllBytes(this.filePath));
|
this.jsonString = new String(Files.readAllBytes(this.filePath), StandardCharsets.UTF_8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import java.io.BufferedWriter;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
@ -69,7 +70,7 @@ public class ArbitraryDataQortalMetadata extends ArbitraryDataMetadata {
|
|||||||
throw new IOException(String.format("Patch file doesn't exist: %s", path.toString()));
|
throw new IOException(String.format("Patch file doesn't exist: %s", path.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.jsonString = new String(Files.readAllBytes(path));
|
this.jsonString = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ public enum Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static JSONObject toJsonObject(byte[] data) {
|
public static JSONObject toJsonObject(byte[] data) {
|
||||||
String dataString = new String(data);
|
String dataString = new String(data, StandardCharsets.UTF_8);
|
||||||
return new JSONObject(dataString);
|
return new JSONObject(dataString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import java.io.BufferedWriter;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
@ -81,7 +82,7 @@ public class ResourceList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String jsonString = new String(Files.readAllBytes(path));
|
String jsonString = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
|
||||||
this.list = ResourceList.listFromJSONString(jsonString);
|
this.list = ResourceList.listFromJSONString(jsonString);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new IOException(String.format("Couldn't read contents from file %s", path.toString()));
|
throw new IOException(String.format("Couldn't read contents from file %s", path.toString()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user