diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-12-14 07:37:52 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-12-14 07:37:52 +0000 |
| commit | 65263cd19edfc913e1f5be57ab98625cd42179a4 (patch) | |
| tree | 584346843b9b42a4fa779223c8e3fee974064df0 | |
| parent | 4213473b32453353ad209fff0e403c6e2fbc9ac0 (diff) | |
- Fix charset conversion for text attachments without charset specification (#1487634)
git-svn-id: https://svn.roundcube.net/trunk@4340 208e9e7b-5314-0410-a742-e7e81cd9613c
| -rw-r--r-- | roundcubemail/CHANGELOG | 1 | ||||
| -rw-r--r-- | roundcubemail/program/include/rcube_imap.php | 17 |
2 files changed, 10 insertions, 8 deletions
diff --git a/roundcubemail/CHANGELOG b/roundcubemail/CHANGELOG index c99e6ebc2..ffc9e9303 100644 --- a/roundcubemail/CHANGELOG +++ b/roundcubemail/CHANGELOG @@ -21,6 +21,7 @@ CHANGELOG Roundcube Webmail - Fix handling of untagged responses for AUTHENTICATE command (#1487450) - Add username and IP address to log message on unsuccessful login (#1487626) - Improved Mail-Followup-To and Mail-Reply-To headers handling +- Fix charset conversion for text attachments without charset specification (#1487634) RELEASE 0.5-BETA ---------------- diff --git a/roundcubemail/program/include/rcube_imap.php b/roundcubemail/program/include/rcube_imap.php index 83c34bc3c..5aa23fa73 100644 --- a/roundcubemail/program/include/rcube_imap.php +++ b/roundcubemail/program/include/rcube_imap.php @@ -2429,20 +2429,21 @@ class rcube_imap // TODO: Add caching for message parts - if (!$part) $part = 'TEXT'; + if (!$part) { + $part = 'TEXT'; + } $body = $this->conn->handlePartBody($this->mailbox, $uid, true, $part, $o_part->encoding, $print, $fp); - if ($fp || $print) + if ($fp || $print) { return true; + } - // convert charset (if text or message part) - if ($body && ($o_part->ctype_primary == 'text' || $o_part->ctype_primary == 'message')) { - // assume default if no charset specified - if (empty($o_part->charset) || strtolower($o_part->charset) == 'us-ascii') - $o_part->charset = $this->default_charset; - + // convert charset (if text or message part) and part's charset is specified + if ($body && $o_part->charset + && preg_match('/^(text|message)$/', $o_part->ctype_primary) + ) { $body = rcube_charset_convert($body, $o_part->charset); } |
