Ticket #1485050: charset-fix.diff

File charset-fix.diff, 3.8 kB (added by Javer, 7 months ago)
  • program/steps/mail/func.inc

    old new  
    232232     
    233233    $out .= sprintf("<td class=\"icon\">%s</td>\n", $message_icon ? sprintf($image_tag, $skin_path, $message_icon, '') : ''); 
    234234 
     235    if (!empty($header->charset)) 
     236      $IMAP->set_charset($header->charset); 
     237   
    235238    // format each col 
    236239    foreach ($a_show_cols as $col) 
    237240      { 
     
    241244        { 
    242245        $action = $mbox==$CONFIG['drafts_mbox'] ? 'compose' : 'show'; 
    243246        $uid_param = $mbox==$CONFIG['drafts_mbox'] ? '_draf_uid' : '_uid'; 
    244         $cont = Q(rcube_imap::decode_mime_string($header->$col, $header->charset)); 
     247        $cont = Q($IMAP->decode_header($header->$col)); 
    245248        if (empty($cont)) $cont = Q(rcube_label('nosubject')); 
    246249        $cont = sprintf('<a href="%s" onclick="return rcube_event.cancel(event)">%s</a>', Q(rcmail_url($action, array($uid_param=>$header->uid, '_mbox'=>$mbox))), $cont); 
    247250        } 
     
    321324    if (empty($header)) 
    322325      continue; 
    323326 
     327    if (!empty($header->charset)) 
     328      $IMAP->set_charset($header->charset); 
     329 
    324330    // format each col; similar as in rcmail_message_list() 
    325331    foreach ($a_show_cols as $col) 
    326332      { 
     
    330336        { 
    331337        $action = $mbox==$CONFIG['drafts_mbox'] ? 'compose' : 'show'; 
    332338        $uid_param = $mbox==$CONFIG['drafts_mbox'] ? '_draf_uid' : '_uid'; 
    333         $cont = Q(rcube_imap::decode_mime_string($header->$col, $header->charset)); 
     339        $cont = Q($IMAP->decode_header($header->$col)); 
    334340        if (!$cont) $cont = Q(rcube_label('nosubject')); 
    335341        $cont = sprintf('<a href="%s" onclick="return rcube_event.cancel(event)">%s</a>', Q(rcmail_url($action, array($uid_param=>$header->uid, '_mbox'=>$mbox))), $cont); 
    336342        } 
     
    974980    else if (in_array($hkey, array('from', 'to', 'cc', 'bcc', 'reply-to'))) 
    975981      $header_value = Q(rcmail_address_string($headers[$hkey], NULL, $attrib['addicon']), 'show'); 
    976982    else 
    977       $header_value = Q(rcube_imap::decode_mime_string($headers[$hkey], $headers['charset'])); 
     983      $header_value = Q($IMAP->decode_header($headers[$hkey])); 
    978984 
    979985    $out .= "\n<tr>\n"; 
    980986    $out .= '<td class="header-title">'.Q(rcube_label($hkey)).":&nbsp;</td>\n"; 
     
    14661472   
    14671473  $message = array('UID' => $uid); 
    14681474  $message['headers'] = $IMAP->get_headers($message['UID']); 
    1469   $message['subject'] = rcube_imap::decode_mime_string($message['headers']->subject, $message['headers']->charset); 
     1475  $message['subject'] = $IMAP->decode_header($message['headers']->subject); 
    14701476   
    14711477  if ($message['headers']->mdn_to && !$message['headers']->mdn_sent) 
    14721478  { 
  • program/steps/mail/show.inc

    old new  
    6161  else if (empty($CONFIG['devel_mode'])) 
    6262    send_modified_header($_SESSION['login_time'], $etag, !$MESSAGE['headers']->seen); 
    6363 
    64   $MESSAGE['subject'] = rcube_imap::decode_mime_string($MESSAGE['headers']->subject, $MESSAGE['headers']->charset); 
     64  $MESSAGE['subject'] = $IMAP->decode_header($MESSAGE['headers']->subject); 
    6565  $OUTPUT->set_pagetitle($MESSAGE['subject']); 
    6666   
    6767  if ($MESSAGE['structure'] = $IMAP->get_structure($MESSAGE['UID'])) 
  • program/include/rcube_imap.php

    old new  
    23622362      } 
    23632363       
    23642364    // no encoding information, use fallback 
    2365     return rcube_charset_convert($input, !empty($fallback) ? $fallback : 'ISO-8859-1'); 
     2365    return rcube_charset_convert($input, !empty($fallback) ? $fallback : $GLOBALS['CONFIG']['default_charset']); 
    23662366    } 
    23672367 
    23682368