Changeset 2064 in subversion


Ignore:
Timestamp:
Nov 19, 2008 2:32:40 AM (5 years ago)
Author:
thomasb
Message:

Remove BOM in html message body + don't require quotes in meta tag specifying charset

File:
1 edited

Legend:

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

    r2051 r2064  
    598598    // special replacements (not properly handled by washtml class) 
    599599    $html_search = array( 
    600         '/(<\/nobr>)(\s+)(<nobr>)/i',   // space(s) between <NOBR> 
    601         '/(<[\/]*st1:[^>]+>)/i',        // Microsoft's Smart Tags <ST1> 
    602         '/<title>.*<\/title>/i',        // PHP bug #32547 workaround: remove title tag 
    603         '/<html[^>]*>/im',              // malformed html: remove html tags (#1485139) 
    604         '/<\/html>/i',                  // malformed html: remove html tags (#1485139) 
     600      '/(<\/nobr>)(\s+)(<nobr>)/i',     // space(s) between <NOBR> 
     601    '/(<[\/]*st1:[^>]+>)/i',    // Microsoft's Smart Tags <ST1> 
     602    '/<title>.*<\/title>/i',    // PHP bug #32547 workaround: remove title tag 
     603    '/<html[^>]*>/im',          // malformed html: remove html tags (#1485139) 
     604    '/<\/html>/i',                      // malformed html: remove html tags (#1485139) 
     605    '/^[\xFE\xFF\xBB\xBF\x00]+((?:<\!doctype|\<html))/im',      // remove byte-order mark (only outlook?) 
    605606    ); 
    606607    $html_replace = array( 
    607         '\\1'.' &nbsp; '.'\\3', 
    608         '', 
    609         '', 
    610         '', 
    611         '', 
     608      '\\1'.' &nbsp; '.'\\3', 
     609      '', 
     610      '', 
     611      '', 
     612      '\\1', 
     613      '', 
    612614    ); 
    613615    $html = preg_replace($html_search, $html_replace, $html); 
    614616 
    615617    // charset was converted to UTF-8 in rcube_imap::get_message_part() -> change charset specification in HTML accordingly 
    616     if (preg_match('/(\s+content=[\'"]\w+\/\w+;\s*charset)=([a-z0-9-_]+)/i', $html))  
    617       $html = preg_replace('/(\s+content=[\'"]\w+\/\w+;\s*charset)=([a-z0-9-_]+)/i', '\\1='.RCMAIL_CHARSET, $html);  
     618    $charset_pattern = '/(\s+content=[\'"]?\w+\/\w+;\s*charset)=([a-z0-9-_]+)/i'; 
     619    if (preg_match($charset_pattern, $html)) { 
     620      $html = preg_replace($charset_pattern, '\\1='.RCMAIL_CHARSET, $html); 
     621    } 
    618622    else { 
    619623      // add head for malformed messages, washtml cannot work without that 
Note: See TracChangeset for help on using the changeset viewer.