网络以字节码传输
String s = "我恨你";
//转成字节:
byte[] brr = s.getBytes();//gbk
//iE:utf-8
String s1 = new String(brr);
brr = s1.getBytes("utf-8");//中:97 98 99
//你
String s2 =new String(brr,"utf-8");//gbk:97 98
System.out.println(s2);
时间: 2024-10-12 23:19:29