java 中文乱码

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");

原文地址:https://www.cnblogs.com/b-dong/p/5988084.html