Skip to main content

Timeline for Validating UTF-8 byte array

Current License: CC BY-SA 3.0

9 events
when toggle format what by license comment
Aug 25, 2017 at 15:54 comment added Patrick Schlüter Lengths of UTF-8 sequences beyond 4 are illegal in Unicode. No need to check after that.
Oct 2, 2015 at 17:12 comment added james.garriss A wee bit of sample code to get you going: CoderResult result = StandardCharsets.UTF_8.newDecoder().onMalformedInput(CodingErrorAction.REPORT).onUnmappableCharacter(CodingErrorAction.REPORT).decode(ByteBuffer.wrap(bytesToTest), CharBuffer.allocate(1024), true);
Oct 2, 2015 at 15:13 comment added Óscar López @james.garriss this was a programming exercise, not production code... but actually, I didn't know about that functionality in CharsetDecoder, so thanks for the heads-up :)
Oct 2, 2015 at 14:50 comment added james.garriss Perhaps you already know it, but you're reinventing the wheel. Java NIO already has this capability. You could go look at NIO's code to see how Oracle did it: java.nio.charset.CharsetDecoder
Aug 14, 2014 at 15:44 history edited Jamal CC BY-SA 3.0
deleted 28 characters in body
Aug 7, 2014 at 23:25 vote accept Óscar López
Aug 7, 2014 at 22:37 answer added JaDogg timeline score: 4
Aug 7, 2014 at 20:47 answer added 200_success timeline score: 14
Aug 7, 2014 at 19:12 history asked Óscar López CC BY-SA 3.0