JAVA byte[]转String 中文问题

 public static void main(String[] args) {
        String str1 = "123456中国";
        byte[] src = str1.getBytes();
        Charset charset = Charset.defaultCharset();
        ByteBuffer buf = ByteBuffer.wrap(src);
        CharBuffer cBuf = charset.decode(buf);

        System.out.println(cBuf.toString());
}

JAVA byte[]转String 中文问题

 

相关文章:

  • 2021-06-03
  • 2022-01-13
  • 2022-12-23
  • 2022-12-23
  • 2021-11-05
猜你喜欢
  • 2022-12-23
  • 2021-06-06
  • 2021-11-09
  • 2021-12-22
相关资源
相似解决方案