笔试题 怎样将 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();
}
}
}
04-18 21:09