java中怎样将utf-8转成GB2312编码
1个回答
2015-07-20
展开全部
String source = "测试字符串";
String result = null;
try {
result = new String(source.getBytes("utf-8"),"gb2312" );
} catch (UnsupportedEncodingException ex) {
result = source;
}
System.err.println(result);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询