Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

handle non-ASCII strings properly in MyClasspath::makeString

  • Loading branch information...
commit 2c902a26ece0891f8240fcb7c1c67542e7da7ccc 1 parent dca75df
@dicej dicej authored
Showing with 17 additions and 1 deletion.
  1. +17 −1 src/classpath-openjdk.cpp
View
18 src/classpath-openjdk.cpp
@@ -504,7 +504,23 @@ class MyClasspath : public Classpath {
object charArray = makeCharArray(t, length);
for (int i = 0; i < length; ++i) {
- expect(t, (byteArrayBody(t, array, offset + i) & 0x80) == 0);
+ if (byteArrayBody(t, array, offset + i) & 0x80) {
+ object constructor = resolveMethod
+ (t, type(t, Machine::StringType), "<init>",
+ "([BIILjava/lang/String;)V");
+ PROTECT(t, constructor);
+
+ object utf8 = vm::makeString(t, "UTF8");
+ PROTECT(t, utf8);
+
+ object s = makeNew(t, type(t, Machine::StringType));
+ PROTECT(t, s);
+
+ t->m->processor->invoke
+ (t, constructor, s, array, offset, length, utf8);
+
+ return s;
+ }
charArrayBody(t, charArray, i) = byteArrayBody(t, array, offset + i);
}
Please sign in to comment.
Something went wrong with that request. Please try again.