svncommit
2009-07-30 a80b7d416ce744b5f5ce92fce0179dd613dd0207
better solution for HTML washing encoding issue

2 files modified
10 ■■■■ changed files
CHANGELOG 2 ●●● patch | view | raw | blame | history
program/steps/mail/func.inc 8 ●●●● patch | view | raw | blame | history
CHANGELOG
@@ -1,12 +1,12 @@
CHANGELOG RoundCube Webmail
===========================
- Fix HTML washing to respect character encoding
- Fix endless loop in iil_C_Login() with Courier IMAP (#1486010)
- Fix #messagemenu display on IE (#1486006)
- Speedup UI by using sprites for (toolbar) buttons
- Fix charset names with X- prefix handling
- Fix displaying of HTML messages with unknown/malformed tags (#1486003)
- Fix HTML washing of non-UTF8 messages
RELEASE 0.3-RC1
---------------
program/steps/mail/func.inc
@@ -685,16 +685,16 @@
  // fix (unknown/malformed) HTML tags before "wash"
  $html = preg_replace_callback('/(<[\/!]*)([^ >]+)/', 'rcmail_html_tag_callback', $html);
  // charset was converted to UTF-8 in rcube_imap::get_message_part() -> change charset specification in HTML accordingly
  // charset was converted to UTF-8 in rcube_imap::get_message_part(),
  // change charset specification in HTML accordingly
  $charset_pattern = '/(\s+content=[\'"]?\w+\/\w+;\s*charset)=([a-z0-9-_]+)/i';
  if (preg_match($charset_pattern, $html)) {
    $html = preg_replace($charset_pattern, '\\1='.RCMAIL_CHARSET, $html);
  } else {
  }
    // add head for malformed messages, washtml cannot work without that
    if (!preg_match('/<head[^>]*>(.*)<\/head>/Uims', $html))
      $html = '<head></head>'. $html;
    $html = substr_replace($html, '<meta http-equiv="content-type" content="text/html; charset='.RCMAIL_CHARSET.'" />', intval(stripos($html, '<head>')+6), 0);
  }
  $html = substr_replace($html, '<meta http-equiv="Content-Type" content="text/html; charset='.RCMAIL_CHARSET.'" />', intval(stripos($html, '<head>')+6), 0);
    
  // turn relative into absolute urls
  $html = rcmail_resolve_base($html);