java中文字符乱码编码转换大全【转】

System.out.println(new String(myFileName.getBytes("gbk")));   
System.out.println(new String(myFileName.getBytes("utf-8"),"gbk"));
System.out.println(new String(myFileName.getBytes("iso-8859-1"),"gbk")); 
System.out.println(new String(myFileName.getBytes("gb2312"), "gbk"));
System.out.println(new String(myFileName.getBytes("utf-8")));   
System.out.println(new String(myFileName.getBytes("gbk"),"utf-8"));
System.out.println(new String(myFileName.getBytes("iso-8859-1"),"utf-8")); 
System.out.println(new String(myFileName.getBytes("gb2312"), "utf-8"));
System.out.println(new String(myFileName.getBytes("iso-8859-1")));   
System.out.println(new String(myFileName.getBytes("gbk"),"iso-8859-1"));
System.out.println(new String(myFileName.getBytes("utf-8"),"iso-8859-1")); 
System.out.println(new String(myFileName.getBytes("gb2312"), "iso-8859-1"));
System.out.println(new String(myFileName.getBytes("gb2312")));   
System.out.println(new String(myFileName.getBytes("gbk"),"gb2312"));
System.out.println(new String(myFileName.getBytes("utf-8"),"gb2312")); 
System.out.println(new String(myFileName.getBytes("iso-8859-1"), "gb2312"));

转自:http://m.blog.csdn.net/xwawa2012/article/details/39579627

你可能感兴趣的:(java中文字符乱码编码转换大全【转】)