We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5373ddc commit b23c658Copy full SHA for b23c658
1 file changed
msgpack-core/src/main/java/org/msgpack/core/MessagePacker.java
@@ -27,6 +27,7 @@
27
import java.nio.charset.CharacterCodingException;
28
import java.nio.charset.CharsetEncoder;
29
import java.nio.charset.CoderResult;
30
+import java.nio.charset.CodingErrorAction;
31
32
import static org.msgpack.core.MessagePack.Code.ARRAY16;
33
import static org.msgpack.core.MessagePack.Code.ARRAY32;
@@ -447,7 +448,9 @@ private void packStringWithGetBytes(String s)
447
448
private void prepareEncoder()
449
{
450
if (encoder == null) {
- this.encoder = MessagePack.UTF8.newEncoder();
451
+ this.encoder = MessagePack.UTF8.newEncoder()
452
+ .onMalformedInput(CodingErrorAction.REPLACE)
453
+ .onUnmappableCharacter(CodingErrorAction.REPLACE);
454
}
455
encoder.reset();
456
0 commit comments