String s = "你好";
byte [] b1 = s.getBytes("GBK");
System.out.println(Arrays.toString(b1));
String s1 = new String(b1,"ISO8859-1");
System.out.println("s1="+s1);
//对S1进行iso8859-1编码.
byte[]b2 = s1.getBytes("iso8859-1");
System.out.println(Arrays.toString(b2));
String s2 = new String(b2,"gbk");
System.out.println("s2="+s2); |
|