4
我有一個處理文件下載的JSP頁面。JSP下載含有空格的文件名文件
我設置的響應頭,像這樣:
response.setContentType("application/octet-stream");
response.addHeader("Content-Disposition","attachment; filename="+fileName);
當文件名包含空格(即「業務Report.doc」),瀏覽器的對話窗口中的文件保存爲「業務」。我試過使用URLEncoder.encode(fileName,「Unicode」);我試過使用URLEncoder.encode(fileName,「Unicode」);我試過使用URLEncoder.encode。 (也試過UTF-8)
但我得到了「Business + Report.doc」作爲結果。
我希望最終結果爲「Business Report.doc」
任何想法?
謝謝。
謝謝!我也會嘗試你的Servlet解決方案。 – hmak 2010-09-07 19:15:15
不客氣。 – BalusC 2010-09-07 19:23:11