Apache2Triad 架站包已有 1.5.4 版(2006-02-20)

摘要:Apache2Triad 架站包已有 1.5.4 版(2006-02-20)

自從在公司安裝了 Apache2Triad + phpBB2 後,有一些問題實在無法解決,如:下載檔案無法大於 2MB (別人都是上傳有問題下載沒問題,而我正好相反, 上傳再大都沒有問題) 及中文檔名的問題。
今天心血來潮,用 google 又找了一下,找到一個 Java 討論區的文章:Java Forums - Non US-ASCII characters in download file names提到:

---------------------------------------
Non US-ASCII characters in download file names
Author: one_dane Posts: 159 Registered: 8/11/03
Jan 4, 2006 10:14 AM

I am trying to implement a simple file download in a JSP, and trying to get IE, Firefox and Opera to all display and handle non US-ASCII characters in the suggested download file name. Only concerned with Windows platform for now. Here's the code I am currently using:

String agent = request.getHeader("USER-AGENT");
if (null != agent && -1 != agent.indexOf("MSIE"))
{
String codedfilename = URLEncoder.encode(cfrfilename, "UTF8");
response.setContentType("application/x-download");
response.setHeader("Content-Disposition","attachment;filename=" + codedfilename);
}
else if (null != agent && -1 != agent.indexOf("Mozilla"))
{
String codedfilename = MimeUtility.encodeText(cfrfilename, "UTF8", "B");
response.setContentType("application/x-download");
response.setHeader("Content-Disposition","attachment;filename=" + codedfilename);
}
else
{
response.setContentType("application/x-download");
response.setHeader("Content-Disposition","attachment;filename=" + cfrfilename);
}

This URL encodes the file name if the browser is IE, MIME encodes it if the browser is Mozilla, and sends plain UTF-8 (the encoding of the JSP) for all other browsers. I get "cfrfilename" from translated properties files, and the string can contain characters from any character set - Chinese, Thai, Korean, etc.

This code works correctly for IE - the file name is displayed correctly in the file Save as dialog, and it is saved correctly on disk, no matter which character set is used.
For Firefox, the file name is displayed correctly in the file Save as dialog, but it is only saved correctly to disk if the file name is in a character set supported by the system locale. This seems to be a known Firefox bug (not fully using the Windows Unicode APIs), so nothing I can do about that.
Nothing seems to work for Opera, however - I cannot get the file name to display correctly in the file Save as dialog, no matter which method I use (I have tried URL encoding and MIME encoding in addition to the plain UTF-8).

Has anybody implemented something similar that works for at least these 3 browsers?
---------------------------------------

我想,利用六日的時間,在家中的電腦測試一下新版的 Apache2Triad 同時測試 phpBB2 備份下來的資料是否可以直接轉到另一主機。