[Jifty-commit] jifty branch, master, updated. 423006b127456056f799e207d4cbd73ca4ad1349

Jifty commits jifty-commit at lists.jifty.org
Tue Dec 15 09:53:20 EST 2009


The branch, master has been updated
       via  423006b127456056f799e207d4cbd73ca4ad1349 (commit)
       via  3f100992d64a522ff1248377201fe6e2bc60f09e (commit)
      from  d56154618d533cafed1950e767fd43873edff895 (commit)

Summary of changes:
 lib/Jifty/Notification.pm |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

- Log -----------------------------------------------------------------
commit 3f100992d64a522ff1248377201fe6e2bc60f09e
Author: c9s <cornelius.howl at gmail.com>
Date:   Tue Dec 15 22:20:44 2009 +0800

    we should keep email content as perl string (with utf8 flag)
    rather than encode it into octets. Email::MIME (at least from 1.901)
    would call Encode::encode to encode perl string into octets again.

diff --git a/lib/Jifty/Notification.pm b/lib/Jifty/Notification.pm
index f3d1277..6137572 100644
--- a/lib/Jifty/Notification.pm
+++ b/lib/Jifty/Notification.pm
@@ -104,12 +104,9 @@ sub send_one_message {
 
     if (defined $self->html_body) {
 
-        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 );
-
+        # NOTICE: we should keep string in perl string (with utf8 flag)
+        # rather then encode it into octets. Email::MIME would call Encode::encode in 
+        # its create function.
         $message = Email::MIME->create_html(
 					     header => [
 							From    => ($self->from    || _('%1 <%2>' , $appname, Jifty->config->framework('AdminEmail'))) ,
@@ -119,8 +116,8 @@ sub send_one_message {
 					     attributes => \%attrs,
                          text_body_attributes => \%attrs,
                          body_attributes => \%attrs,
-					     text_body => $fullbody,
-					     body => $fullhtml,
+					     text_body => $self->fullbody,
+					     body => $self->fullhtml,
                          embed => 0,
                          inline_css => 0
 					    );
@@ -322,11 +319,12 @@ Returns the parts as an array reference.
 
 sub parts {
   my $self = shift;
-  my $fullbody = $self->full_body;
-  $fullbody = Encode::encode_utf8( $fullbody ) unless Encode::is_utf8( $fullbody );
+# NOTICE: we should keep string in perl string (with utf8 flag)
+# rather then encode it into octets. Email::MIME would call Encode::encode in 
+# its create function.
   return [ Email::MIME->create(
       attributes => { charset => 'UTF-8' },
-      body       => $fullbody,
+      body       => $self->full_body,
     ) ];
 }
 

commit 423006b127456056f799e207d4cbd73ca4ad1349
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Tue Dec 15 09:45:11 2009 -0500

    fullbody is spelled full_body, and fullhtml full_html

diff --git a/lib/Jifty/Notification.pm b/lib/Jifty/Notification.pm
index 6137572..e3d89e4 100644
--- a/lib/Jifty/Notification.pm
+++ b/lib/Jifty/Notification.pm
@@ -116,8 +116,8 @@ sub send_one_message {
 					     attributes => \%attrs,
                          text_body_attributes => \%attrs,
                          body_attributes => \%attrs,
-					     text_body => $self->fullbody,
-					     body => $self->fullhtml,
+					     text_body => $self->full_body,
+					     body => $self->full_html,
                          embed => 0,
                          inline_css => 0
 					    );

-----------------------------------------------------------------------


More information about the Jifty-commit mailing list