Skip to content

Commit

Permalink
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -115,7 +115,12 @@ public static Rope withEncodingVerySlow(Rope originalRope, Encoding newEncoding)

@TruffleBoundary
public static String decodeUTF8(Rope rope) {
return RubyEncoding.decodeUTF8(rope.getBytes(), 0, rope.byteLength());
return decodeUTF8(rope.getBytes(), 0, rope.byteLength());
}

@TruffleBoundary
public static String decodeUTF8(byte[] bytes, int offset, int byteLength) {
return RubyEncoding.decodeUTF8(bytes, offset, byteLength);
}

@TruffleBoundary
Original file line number Diff line number Diff line change
@@ -56,7 +56,8 @@ public int getOffset() {
@Override
public String toString() {
// This should be used for debugging only.
return child.toString().substring(offset, offset + byteLength());
final byte[] childBytes = RopeOperations.extractRange(child, offset, byteLength());
return RopeOperations.decodeUTF8(childBytes, 0, childBytes.length);
}

}

0 comments on commit 736f2e7

Please sign in to comment.