keith-turner commented on issue #88:
URL: https://github.com/apache/accumulo-access/issues/88#issuecomment-3643005527
> So fail in this context is due to invalid column visibility structure, not
encoding. If the structure is valid, then non-UTF-8 chars will be encoded as a
. in the resulting String. Is that correct?
Yeah when using the string constructor that takes bytes that will happen.
Would have to do something like the following to fail on invalid utf8. Not
sure if this the most efficient way to do this in java though.
```java
public static String decodeUtf8(byte[] input) throws
CharacterCodingException {
// could this be static final?
var decoder =
StandardCharsets.UTF_8.newDecoder().onUnmappableCharacter(CodingErrorAction.REPORT).onMalformedInput(CodingErrorAction.REPORT);
CharBuffer charBuffer = decoder.decode(ByteBuffer.wrap(input));
return new String(charBuffer.array());
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]