7 月 18 2008
RoundCube 的郵件中文夾檔問題
這兩天在處理 RoundCube 的郵件中文夾檔問題。
 原本覺得情況很詭異,因為 Firefox 都很正常,可是 IE 有這兩種狀況:
- 直接以左鍵點選,中文檔名的附帶夾檔無法下載。
- 以滑鼠中鍵(開新的 Tab),就正常了。
坦白說,RoundCube 的程式架構實在很難摸,所以追了蠻久的..
我幫忙追問題的 RoundCube 版本是 0.1-STABLE 。
 最後追到的解法是去修改 program/steps/mail/get.inc , diff -u 生出來的檔案內容是這樣:
--- program/steps/mail/get.inc.orig     2008-07-18 02:01:46.000000000 +0800
+++ program/steps/mail/get.inc  2008-07-18 15:45:37.000000000 +0800
@@ -106,9 +106,19 @@
       }
     else
       {
-      header(sprintf("Content-Disposition: %s; filename="%s";",
+       $HTTP_USER_AGENT = $_SERVER["HTTP_USER_AGENT"];
+
+       if (strstr($HTTP_USER_AGENT, "compatible; MSIE ") !== false &&
+            strstr($HTTP_USER_AGENT, "Opera") === false) {
+             header(sprintf("Content-Disposition: %s; filename="%s";",
+                     $_GET["_download"] ? "attachment" : "inline",
+                     $part->filename ? rawurlencode(abbreviate_string($part->filename, 55)) :
+                                       rawurlencode("roundcube.$ctype_secondary")));
+       } else {
+             header(sprintf("Content-Disposition: %s; filename="%s";",
                      $_GET["_download"] ? "attachment" : "inline",
                      $part->filename ? abbreviate_string($part->filename, 55) : "roundcube.$ctype_secondary"));
+       }
       // turn off output buffering and print part content
       $IMAP->get_message_part($MESSAGE["UID"], $part->mime_id, $part, true);關鍵就在… 給 IE 吃的話,要先用 rawurlencode() 處理一遍。 
 
  
  
  
  
  
  
 




 
 
2009-02-16 @ 18:48
請問顯示標題跟內文因編碼有問題而無法正常,可否修正或是預設改為big5 ?