Ignore:
Timestamp:
Mar 9, 2010 6:23:35 AM (3 years ago)
Author:
alec
Message:
  • Improved charset replacement in html meta header (#1486542)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/steps/mail/func.inc

    r3310 r3342  
    683683{ 
    684684  global $REMOTE_OBJECTS; 
    685    
     685 
    686686  $p += array('safe' => false, 'inline_html' => true); 
    687687 
     
    689689  $html_search = array( 
    690690    '/(<\/nobr>)(\s+)(<nobr>)/i',       // space(s) between <NOBR> 
    691     '/<title[^>]*>.*<\/title>/i',               // PHP bug #32547 workaround: remove title tag 
     691    '/<title[^>]*>.*<\/title>/i',       // PHP bug #32547 workaround: remove title tag 
    692692    '/^(\0\0\xFE\xFF|\xFF\xFE\0\0|\xFE\xFF|\xFF\xFE|\xEF\xBB\xBF)/',    // byte-order mark (only outlook?) 
    693693    '/<html\s[^>]+>/i',                 // washtml/DOMDocument cannot handle xml namespaces 
     
    706706  // charset was converted to UTF-8 in rcube_imap::get_message_part(), 
    707707  // -> change charset specification in HTML accordingly 
    708   $charset_pattern = '(<meta\s+[^>]*)(content=[\'"]?\w+\/\w+;\s*charset)=([a-z0-9-_]+)'; 
     708  $charset_pattern = '(<meta\s+[^>]* content=)[\'"]?(\w+\/\w+;\s*charset=)([a-z0-9-_]+[\'"]?)'; 
    709709  if (preg_match("/$charset_pattern/Ui", $html)) { 
    710     $html = preg_replace("/$charset_pattern/i", '\\1\\2='.RCMAIL_CHARSET, $html); 
     710    $html = preg_replace("/$charset_pattern/i", '\\1"\\2'.RCMAIL_CHARSET.'"', $html); 
    711711  } 
    712712  else { 
Note: See TracChangeset for help on using the changeset viewer.