1. 程式人生 > >檔案上傳中文路徑亂碼

檔案上傳中文路徑亂碼

public static String toUTF8(String str){
String rt = null;

try {
if(str!=null){
rt = new String(str.getBytes("gbk"),"UTF-8");
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return rt;
}