笔试题 怎样将 GB2312 编码的字符串转换为 ISO-8859-1 编码的字符串?

import java.io.UnsupportedEncodingException;

public class Test {
    public static void main(String[] args) {
        String s1 = "你好";
        try {
            String s2 = new String(s1.getBytes("GB2312"), "ISO-8859-1");
            System.out.println(s2);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
    }
}

相关文章:

  • 2022-12-23
  • 2022-01-01
  • 2021-11-27
  • 2022-12-23
  • 2021-11-27
  • 2021-08-11
  • 2021-12-20
  • 2021-11-18
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-01
  • 2022-02-12
  • 2021-10-19
相关资源
相似解决方案