1.URL编码
String str = URLEncoder.encode("中文乱码","UTF-8");//编码
String newStr = URLDecoder.decode(str,"UTF-8");//解码
2.new String()
String str = new String("中文乱码".getBytes(),"UTF-8");
时间: 2024-10-12 05:06:54
1.URL编码
String str = URLEncoder.encode("中文乱码","UTF-8");//编码
String newStr = URLDecoder.decode(str,"UTF-8");//解码
2.new String()
String str = new String("中文乱码".getBytes(),"UTF-8");