用poi生成名字为中文的word文档可是下载不下来,怎么解决??
String  fileName = "excel/" + servicerequestPojo.getSummary()  + ".doc";
servicerequestPojo.getSummary()有时候是中文的。可是下载不下来 。怎么解决啊

解决方案 »

  1.   


    response.setBufferSize(0x19000);
    response.setHeader("Cache-Control", "public");
    response.setContentType("application/vnd.ms-word;charset=UTF-8");
    response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode("这个.doc", "UTF-8"));
    java.io.OutputStream output = response.getOutputStream();试试
      

  2.   

    差不多    下载要路径  。而路径是中文  所以就要设置路劲编码了。
     String summary=null;
    try {
    summary = java.net.URLEncoder.encode(servicerequestPojo.getSummary(),"UTF-8");
    } catch (UnsupportedEncodingException e) {
    // TODO Auto-generated catch block
     throw new RuntimeException(e);

    String  fileName = "word/" +summary+ ".doc";