summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-04-08 06:18:11 +0000
committeralecpl <alec@alec.pl>2011-04-08 06:18:11 +0000
commit8abc17611f56e3bd265c9d6a1782771ea3165344 (patch)
tree3cb7e6eea1ae40683d61f93e9ec8acd19163dbe6
parentf66f5f02e30d9fc2d5c06eeefb4377b8ff36fce2 (diff)
- Fix bug where default_charset was not used for text messages (#1487836)
-rw-r--r--CHANGELOG1
-rw-r--r--program/include/rcube_imap.php13
2 files changed, 10 insertions, 4 deletions
diff --git a/CHANGELOG b/CHANGELOG
index b9b5ae4fb..e52b9730b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
+- Fix bug where default_charset was not used for text messages (#1487836)
- Enable TinyMCE's contextmenu (#1487014)
- TinyMCE 3.4.1
- Stateless request tokens. No keep-alive necessary on login page (#1487829)
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index b998c224e..79acdeed9 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -2426,9 +2426,11 @@ class rcube_imap
* @param rcube_message_part $o_part Part object created by get_structure()
* @param mixed $print True to print part, ressource to write part contents in
* @param resource $fp File pointer to save the message part
+ * @param boolean $skip_charset_conv Disables charset conversion
+ *
* @return string Message/part body if not printed
*/
- function &get_message_part($uid, $part=1, $o_part=NULL, $print=NULL, $fp=NULL)
+ function &get_message_part($uid, $part=1, $o_part=NULL, $print=NULL, $fp=NULL, $skip_charset_conv=false)
{
// get part encoding if not provided
if (!is_object($o_part)) {
@@ -2458,10 +2460,13 @@ class rcube_imap
return true;
}
- // 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)
+ // convert charset (if text or message part)
+ if ($body && !$skip_charset_conv &&
+ preg_match('/^(text|message)$/', $o_part->ctype_primary)
) {
+ if (!$o_part->charset || strtoupper($o_part->charset) == 'US-ASCII') {
+ $o_part->charset = $this->default_charset;
+ }
$body = rcube_charset_convert($body, $o_part->charset);
}