I'm writing the newsletter template, and nodes to be included in newsletter, with ckeditor, latin UTF8 characters are not encoded to HTML entities as Drupal support UTF8.

Working with newsletter module (tried dev and last stable release) with default drupal sendmail behaviour, latin characters are utf-8 encoded (without need) resulting in a very messy output like from

"le giornate sono più lunghe, le temperature più miti"

to

"le giornate sono più lunghe, le temperature più miti"

.

I can't find where this conversione is done, please help.

Comments

d.sibaud’s picture

Priority: Major » Normal

Pardon, maybe major is too high for this, reverted to normal.

d.sibaud’s picture

d.sibaud’s picture

Assigned: Unassigned » d.sibaud
Status: Active » Needs review

found the problem:
DomDocument make a utf-8 encoding of the message, to avoid this problem I added the attributes $dom->substituteEntities = true; on line 21 of includes/newsletter.mail.inc:

public function add_newsletter_url_query($message) {
    if (isset($message['params']['newsletter']->nnid)) {
      global $base_url;
      $nnid = $message['params']['newsletter']->nnid;
      $dom = new DomDocument;
      $dom->substituteEntities = true;
      @$dom->loadHTML($message['body']);
      $links = $dom->getElementsByTagName('a');
      foreach ($links as $link) {
        $href = $link->getAttribute('href');
        if (strpos($href, $base_url) !== FALSE) {
          $href = drupal_parse_url($href);
          $query = array_merge($href['query'], array('source' => 'newsletter', 'nnid' => $nnid));
          $link->setAttribute('href', url($href['path'], array('query' => $query)));
        }
      }
      return $dom->saveHTML();
    }
    return $message['body'];
  }
ParisLiakos’s picture

Status: Needs review » Fixed

Thanks,commited it

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nuk3dene’s picture

does it fix the problem or not? mine is not fixed. i just open includes/newsletter.mail.inc in notepad. add line and saved. but i still Сайн байна уу? Та манай Ð°Ð¹Ñ‚Ð°Ð°Ñ мэдээлэл энэ өдрийн get this error.