Bugzilla – Attachment 37018 Details for
Bug 12739
SendAlerts function does not take care of "html" format or UTF-8
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12739: (QA followup) use 'UTF-8' instead of 'utf8'
Bug-12739-QA-followup-use-UTF-8-instead-of-utf8.patch (text/plain), 5.09 KB, created by
Tomás Cohen Arazi
on 2015-03-19 18:21:56 UTC
(
hide
)
Description:
Bug 12739: (QA followup) use 'UTF-8' instead of 'utf8'
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi
Created:
2015-03-19 18:21:56 UTC
Size:
5.09 KB
patch
obsolete
>From 439e01f7b46f7ab4eb3bcebdf8390b32574b1b60 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@gmail.com> >Date: Thu, 19 Mar 2015 15:18:32 -0300 >Subject: [PATCH] Bug 12739: (QA followup) use 'UTF-8' instead of 'utf8' > >This patch makes Encode::encode be passed the 'UTF-8' encoding >instead of the discouraged 'utf8'. > >Please read: >http://wiki.koha-community.org/wiki/Handling_UTF8_in_development > >Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com> >--- > C4/Letters.pm | 37 ++++++++++++++++++++++++++----------- > 1 file changed, 26 insertions(+), 11 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 405dfed..fb21c38 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -429,9 +429,14 @@ sub SendAlerts { > from => $branchdetails->{'branchemail'}, > replyto => $branchdetails->{'branchreplyto'}, > sender => $branchdetails->{'branchreturnpath'}, >- subject => Encode::encode( "utf8", "" . $letter->{title} ), >- message => $letter->{'is_html'} ? _wrap_html( Encode::encode( "utf8", $letter->{'content'} ), Encode::encode( "utf8", "" . $letter->{'title'} ) ) : Encode::encode( "utf8", "" . $letter->{'content'} ), >- contenttype => $letter->{'is_html'} ? 'text/html; charset="utf-8"' : 'text/plain; charset="utf-8"', >+ subject => Encode::encode( "UTF-8", "" . $letter->{title} ), >+ message => $letter->{'is_html'} >+ ? _wrap_html( Encode::encode( "UTF-8", $letter->{'content'} ), >+ Encode::encode( "UTF-8", "" . $letter->{'title'} )) >+ : Encode::encode( "UTF-8", "" . $letter->{'content'} ), >+ contenttype => $letter->{'is_html'} >+ ? 'text/html; charset="utf-8"' >+ : 'text/plain; charset="utf-8"', > } > ); > sendmail(%mail) or carp $Mail::Sendmail::error; >@@ -515,9 +520,14 @@ sub SendAlerts { > To => join( ',', @email), > Cc => join( ',', @cc), > From => $userenv->{emailaddress}, >- Subject => Encode::encode( "utf8", "" . $letter->{title} ), >- Message => $letter->{'is_html'} ? _wrap_html( Encode::encode( "utf8", $letter->{'content'} ), Encode::encode( "utf8", "" . $letter->{'title'} ) ) : Encode::encode( "utf8", "" . $letter->{'content'} ), >- 'Content-Type' => $letter->{'is_html'} ? 'text/html; charset="utf-8"' : 'text/plain; charset="utf-8"', >+ Subject => Encode::encode( "UTF-8", "" . $letter->{title} ), >+ Message => $letter->{'is_html'} >+ ? _wrap_html( Encode::encode( "UTF-8", $letter->{'content'} ), >+ Encode::encode( "UTF-8", "" . $letter->{'title'} )) >+ : Encode::encode( "UTF-8", "" . $letter->{'content'} ), >+ 'Content-Type' => $letter->{'is_html'} >+ ? 'text/html; charset="utf-8"' >+ : 'text/plain; charset="utf-8"', > ); > > $mail{'Reply-to'} = C4::Context->preference('ReplytoDefault') >@@ -564,9 +574,14 @@ sub SendAlerts { > from => $branchdetails->{'branchemail'}, > replyto => $branchdetails->{'branchreplyto'}, > sender => $branchdetails->{'branchreturnpath'}, >- subject => Encode::encode( "utf8", "" . $letter->{'title'} ), >- message => $letter->{'is_html'} ? _wrap_html( Encode::encode( "utf8", $letter->{'content'} ), Encode::encode( "utf8", "" . $letter->{'title'} ) ) : Encode::encode( "utf8", "" . $letter->{'content'} ), >- contenttype => $letter->{'is_html'} ? 'text/html; charset="utf-8"' : 'text/plain; charset="utf-8"', >+ subject => Encode::encode( "UTF-8", "" . $letter->{'title'} ), >+ message => $letter->{'is_html'} >+ ? _wrap_html( Encode::encode( "UTF-8", $letter->{'content'} ), >+ Encode::encode( "UTF-8", "" . $letter->{'title'} ) ) >+ : Encode::encode( "UTF-8", "" . $letter->{'content'} ), >+ contenttype => $letter->{'is_html'} >+ ? 'text/html; charset="utf-8"' >+ : 'text/plain; charset="utf-8"', > } > ); > sendmail(%mail) or carp $Mail::Sendmail::error; >@@ -1132,8 +1147,8 @@ sub _send_message_by_email { > > my $utf8 = decode('MIME-Header', $message->{'subject'} ); > $message->{subject}= encode('MIME-Header', $utf8); >- my $subject = encode('utf8', $message->{'subject'}); >- my $content = encode('utf8', $message->{'content'}); >+ my $subject = encode('UTF-8', $message->{'subject'}); >+ my $content = encode('UTF-8', $message->{'content'}); > my $content_type = $message->{'content_type'} || 'text/plain; charset="UTF-8"'; > my $is_html = $content_type =~ m/html/io; > my $branch_email = undef; >-- >2.3.3
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12739
:
34655
|
34656
|
34657
|
36174
|
36175
|
37015
|
37016
| 37018