diff --git a/runtime/src/main/java/org/capnproto/Text.java b/runtime/src/main/java/org/capnproto/Text.java index 51edafa..0f43432 100644 --- a/runtime/src/main/java/org/capnproto/Text.java +++ b/runtime/src/main/java/org/capnproto/Text.java @@ -1,7 +1,6 @@ package org.capnproto; import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; public final class Text { @@ -18,7 +17,7 @@ public final class Text { public Reader(String value) { try { - byte[] bytes = value.getBytes(StandardCharsets.UTF_8.name()); + byte[] bytes = value.getBytes("UTF-8"); this.buffer = ByteBuffer.wrap(bytes); this.offset = 0; this.size = bytes.length; @@ -35,7 +34,7 @@ public final class Text { this.buffer.get(bytes, 0, this.size); try { - return new String(bytes, StandardCharsets.UTF_8.name()); + return new String(bytes, "UTF-8"); } catch (java.io.UnsupportedEncodingException e) { return "unsupported encoding"; // XXX } @@ -64,7 +63,7 @@ public final class Text { this.buffer.get(bytes, 0, this.size); try { - return new String(bytes, StandardCharsets.UTF_8.name()); + return new String(bytes, "UTF-8"); } catch (java.io.UnsupportedEncodingException e) { return "unsupported encoding"; // XXX }