现在的情况是如果要下载的文件的路径(含文件名)有中文字符的话抛异常,说是找不到文件流,英文路径下载正常。public InputStream getWebFile() { try {
return new FileInputStream(filePath);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null; } @Override
public String execute() throws Exception {


int start=filePath.lastIndexOf("\\");
        fileName=filePath.substring(start+1);
        filePath=new String(filePath.getBytes(),"ISO-8859-1");
        fileName=new String(fileName.getBytes(),"ISO-8859-1");
        
return SUCCESS; }
这里的filePath是文件的全路径,请问怎 么解决这个问题?谢谢!!

解决方案 »

  1.   

    new String(fileName,"ISO-8859-1");原因是:客户传来的中文被服务器试图接受时,更改为了以其他格式扩张的字符集....所以要先对FILENAME的字符集进行指定....
      

  2.   

    这个问题,我昨天解决了,就是在tomcat的service.xml<Connector port="8080" maxHttpHeaderSize="8192" 
            maxThreads="150" minSpareThreads="25" maxSpareThreads="75" 
            enableLookups="false" redirectPort="8443" acceptCount="100" 
            connectionTimeout="20000" URIEncoding="UTF-8"/> 就做这些修改就行了。希望对你有用