Netty ISO8583 decode contains persian characters on field 48.860

Viewed 40

I am trying to decode Iso8583 that contains Persian characters in field 48 tag 860, but I faced and exception of StringIndexOutOfBoundsException.

protected void decode(ChannelHandlerContext ctx, ByteBuf byteBuf, List out) throws Exception {
    logger.info("decoding a new iso message: {}", byteBuf.readableBytes());

    if (!byteBuf.isReadable()) {
        logger.info("message is not readable");
        return;
    }
    byte[] bytes = new byte[byteBuf.readableBytes()];
    byteBuf.readBytes(bytes);

    try {
        final IsoMessage isoMessage = messageFactory.parseMessage(bytes, isoHeaderLength);
        if (isoMessage != null) {
            out.add(isoMessage);
        } else {
            throw new ParseException("Can't parse ISO8583 message", 0);
        }

    } catch (Exception e) {
        logger.info("exceptionss");
        e.printStackTrace();
    }
}
0 Answers
Related