iso-8859-1转utf-8编码

try {
    if (StringUtils.isNotBlank(reason) && reason.equals(new String(reason.getBytes("ISO8859-1"), "ISO8859-1"))) {
       reason = new String(reason.getBytes("ISO8859-1"), "UTF-8");
    }
} catch (UnsupportedEncodingException e) {
            throw e;
}

猜你喜欢

转载自blog.csdn.net/xiaobao5214/article/details/78522012
今日推荐