牧码

时间不多,道路很长

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

使用的函数:

public String(byte bytes[], String charsetName)
            throws UnsupportedEncodingException {
	this(bytes, 0, bytes.length, charsetName);
}

代码:

String s1 = "你好";
String s2 = new String(s1.getBytes("GB2312"), "ISO-8859-1");
posted @ 2019-01-04 16:06  脚印在泥泞路上  阅读(934)  评论(0编辑  收藏  举报