Package: squirrelmail
Version: 2:1.4.9a-2
Severity: normal

    I'm getting trouble in Firefox/Iceweasel to read and download
attachment files that use special characters like "á", "à", "é", "è",
"ç", etc. in its name. When I click to download them I got an error
page in these browsers but it (strangely) works fine in the Internet
Explorer.

    My encoding settings are defined as below:
        ...
        $squirrelmail_default_language = 'pt_BR';
        $default_charset       = 'iso-8859-1';
        $lossy_encoding        = true;
        ...

    I tried to debug the code and I fixed the problem by sending the
filename encoded as quoted printable if the the user isn't using a
browser of the Internet Explorer's family. I couldn't find a
"quoted_printable_encode" function in the original code so I create a
new one and added it in a separated file named
"/functions/quoted_printable.php". To fix the problem I called the new
method at some specific places the the "/functions/mime.php".

    I'm sending the mime.php patch and the file containing the
"quoted_printable_encode" function. I don't know if this is the best
way to solve the problem but it worked for me. :)


-- 
Atenciosamente,

Arthur Furlan
[email protected]

<<attachment: quoted_printable.php>>

--- mime.php    2009-05-15 11:53:19.000000000 -0300
+++ mime-patched.php    2009-05-15 12:35:10.000000000 -0300
@@ -15,6 +15,7 @@
 /** The typical includes... */
 require_once(SM_PATH . 'functions/imap.php');
 require_once(SM_PATH . 'functions/attachment_common.php');
+require_once(SM_PATH . 'functions/quoted_printable.php');
 
 /* -------------------------------------------------------------------------- */
 /* MIME DECODING                                                              */
@@ -2392,6 +2393,11 @@
 
         //set the inline header for IE, we'll add the attachment header later if we need it
         header ("Content-Disposition: inline; filename=$filename");
+    } else {
+        // Returns the $filename encoded as "quoted printable" because if the
+        // filename contains special characters, they'll break the open/download
+        // feature for some browsers (Firefox/Iceweasel) and encodings.
+       $filename = quoted_printable_encode($filename);
     }
 
     if (!$force) {

Reply via email to