publicstaticvoid main(String args[]) throws Exception {
String s = "abc\uD800\uDC00qrst"; // Valid surrogate char[] c = s.toCharArray();
CharsetEncoder enc = Charset.forName("ISO8859_1").newEncoder()
.onUnmappableCharacter(CodingErrorAction.REPLACE); /* Process the first 4 characters, including the high surrogate
which should be stored */
ByteBuffer bb = ByteBuffer.allocate(10);
CharBuffer cb = CharBuffer.wrap(c);
cb.limit(4);
enc.encode(cb, bb, false);
cb.limit(7);
enc.encode(cb, bb, true); byte[] first = bb.array(); for(int i = 0; i < 7; i++)
System.err.printf("[%d]=%d was %d\n",
i,
(int) first[i] &0xffff,
(int) c[i] & 0xffff);
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet am 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.