thomascube
2008-06-07 350459486d421675cb63ebdedf5b7d0cf3ceeb99
Change meta-charset specififcation in HTML to UTF-8; no need for mb_convert_encoding() anymore

2 files modified
9 ■■■■■ changed files
program/lib/washtml.php 2 ●●●●● patch | view | raw | blame | history
program/steps/mail/func.inc 7 ●●●● patch | view | raw | blame | history
program/lib/washtml.php
@@ -187,8 +187,6 @@
    //Charset seems to be ignored (probably if defined in the HTML document)
    $node = new DOMDocument('1.0', $config['charset']);
    $full = true;
    if (function_exists('mb_convert_encoding'))
      $html = mb_convert_encoding($html, 'HTML-ENTITIES', $config['charset']);
    @$node->loadHTML($html);
    return self::dumpHtml($node, $config, $full);
  }
program/steps/mail/func.inc
@@ -534,12 +534,15 @@
  }
  // text/html
  else if ($part->ctype_secondary == 'html') {
    // charset was converted to UTF-8 in rcube_imap::get_message_part() -> change charset specification in HTML accordingly
    $html = preg_replace('/(\s+content=[\'"]\w+\/\w+;\s+charset)=([a-z0-9-]+)/i', '\\1='.RCMAIL_CHARSET, $part->body);
    // clean HTML with washhtml by Frederic Motte
    $body = washtml::wash($part->body, array(
    $body = washtml::wash($html, array(
      'show_washed' => false,
      'allow_remote' => $safe,
      'blocked_src' => "./program/blocked.gif",
      'charset' => 'UTF-8',
      'charset' => RCMAIL_CHARSET,
      'cid_map' => $part->replaces,
      ), $full_inline);