java文件名中文乱码解决 String jsonFileName = ""; jsonFileName = new String(file.getName().getBytes(),"gb2312"); System.out.println("1====="+jsonFileName); jsonFileName = new String(file.getName().getBytes(),"GBK"); System.out.println("2====="+jsonFileName); jsonFileName = new String(file.getName().getBytes(),"utf-8"); System.out.println("3====="+jsonFileName); jsonFileName = new String(file.getName().getBytes(),"gb2312"); System.out.println("4====="+jsonFileName); jsonFileName = new String(file.getName().getBytes("ISO8859-1"),"utf-8"); System.out.println("5====="+jsonFileName); jsonFileName = new String(file.getName().getBytes("ISO8859-1"),"GBK"); System.out.println("6====="+jsonFileName); jsonFileName = new String(file.getName().getBytes("ISO8859-1"),"gb2312"); System.out.println("7====="+jsonFileName); jsonFileName = new String(file.getName().getBytes("ISO-8859-1"),"utf-8"); System.out.println("8====="+jsonFileName); jsonFileName = new String(file.getName().getBytes("ISO-8859-1"),"GBK"); System.out.println("9====="+jsonFileName); jsonFileName = new String(file.getName().getBytes("ISO-8859-1"),"gb2312"); System.out.println("10====="+jsonFileName);