[Jifty-commit] r7700 - jifty/trunk/lib/Jifty

Jifty commits jifty-commit at lists.jifty.org
Mon Dec 7 22:47:29 EST 2009


Author: c9s
Date: Mon Dec  7 22:47:29 2009
New Revision: 7700

Modified:
   jifty/trunk/lib/Jifty/Notification.pm

Log:
for notification of sending html body , only encode_utf8 when text is not in utf8

Modified: jifty/trunk/lib/Jifty/Notification.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Notification.pm	(original)
+++ jifty/trunk/lib/Jifty/Notification.pm	Mon Dec  7 22:47:29 2009
@@ -103,7 +103,14 @@
     my %attrs = ( charset => 'UTF-8' );
 
     if (defined $self->html_body) {
-      $message = Email::MIME->create_html(
+
+        my $fullbody = $self->full_body;
+        my $fullhtml = $self->full_html;
+
+        $fullbody = Encode::encode_utf8( $fullbody ) unless Encode::is_utf8( $fullbody );
+        $fullhtml = Encode::encode_utf8( $fullhtml ) unless Encode::is_utf8( $fullhtml );
+
+        $message = Email::MIME->create_html(
 					     header => [
 							From    => ($self->from    || _('%1 <%2>' , $appname, Jifty->config->framework('AdminEmail'))) ,
 							To      => $to,
@@ -112,8 +119,8 @@
 					     attributes => \%attrs,
                          text_body_attributes => \%attrs,
                          body_attributes => \%attrs,
-					     text_body => Encode::encode_utf8($self->full_body),
-					     body => Encode::encode_utf8($self->full_html),
+					     text_body => $fullbody,
+					     body => $fullhtml,
                          embed => 0,
                          inline_css => 0
 					    );


More information about the Jifty-commit mailing list