编码转化

已知String s;

1. 把String转换成数组:

Byte[] a = s.getBytes("iso-8859-1");

2.把字节数组转换成String:

String str = new String(a,"gbk");

3.综上:把原本中文乱码转换为中文:

String string = new String(s.getBytes("iso-8859-1"),"gbk");

posted @ 2012-09-24 21:30  NewObject_1  阅读(135)  评论(0编辑  收藏  举报