For java CharsetDecoder, there's [CodingErrorAction](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/nio/charset/CodingErrorAction.html) to set behavior on error
For java CharsetDecoder, there's CodingErrorAction to set behavior on error