mirror of
https://github.com/corda/corda.git
synced 2025-01-04 20:24:17 +00:00
set default file.encoding to UTF-8 in classpath-openjdk.cpp
This default makes more sense than ASCII, which is what it had been.
This commit is contained in:
parent
9f8369c5cc
commit
aa513c2c1d
@ -3285,7 +3285,7 @@ jvmInitProperties(Thread* t, uintptr_t* arguments)
|
||||
static_cast<Finder*>
|
||||
(systemClassLoaderFinder(t, root(t, Machine::BootLoader)))->path());
|
||||
|
||||
local::setProperty(t, method, *properties, "file.encoding", "ASCII");
|
||||
local::setProperty(t, method, *properties, "file.encoding", "UTF-8");
|
||||
#ifdef ARCH_x86_32
|
||||
local::setProperty(t, method, *properties, "os.arch", "x86");
|
||||
#elif defined ARCH_x86_64
|
||||
|
@ -7,6 +7,31 @@ public class Strings {
|
||||
return a == b || (a != null && a.equals(b));
|
||||
}
|
||||
|
||||
private static boolean arraysEqual(byte[] a, byte[] b) {
|
||||
if (a.length != b.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < a.length; ++i) {
|
||||
if (a[i] != b[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static byte[] append(byte[] a, byte[] b) {
|
||||
byte[] c = new byte[a.length + b.length];
|
||||
for (int i = 0; i < a.length; ++i) {
|
||||
c[i] = a[i];
|
||||
}
|
||||
for (int i = 0; i < b.length; ++i) {
|
||||
c[i + a.length] = b[i];
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
private static boolean arraysEqual(Object[] a, Object[] b) {
|
||||
if (a.length != b.length) {
|
||||
return false;
|
||||
@ -146,5 +171,27 @@ public class Strings {
|
||||
"I", "grape", "nuts", "foobar",
|
||||
new Object() { public String toString() { return "you"; } })
|
||||
.equals("I enjoy grape nuts. do you? you do?"));
|
||||
|
||||
{ java.io.ByteArrayOutputStream bout = new java.io.ByteArrayOutputStream();
|
||||
java.io.PrintStream pout = new java.io.PrintStream(bout);
|
||||
String s = "I ♥ grape nuts";
|
||||
System.out.println(s);
|
||||
pout.println(s);
|
||||
|
||||
expect
|
||||
(arraysEqual
|
||||
(bout.toByteArray(),
|
||||
(s + System.getProperty("line.separator")).getBytes()));
|
||||
|
||||
// note that this effectively asserts that the VM's default
|
||||
// charset is UTF-8. If we want to make this test more
|
||||
// portable, we should specify the charset explicitly.
|
||||
expect
|
||||
(arraysEqual
|
||||
(bout.toByteArray(), append
|
||||
(new byte[] { 73, 32, -30, -103, -91, 32, 103, 114, 97, 112, 101,
|
||||
32, 110, 117, 116, 115 },
|
||||
System.getProperty("line.separator").getBytes())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user