Bugzilla – Attachment 11804 Details for
Bug 8378
<fine> syntax not working on overdues anymore
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug-8378-fine-syntax-broken-NFC-and-charset-utf8
0001-Bug-8378-fine-syntax-broken-NFC-and-charset-utf8.patch (text/plain), 3.43 KB, created by
wajasu
on 2012-08-23 18:58:03 UTC
(
hide
)
Description:
Bug-8378-fine-syntax-broken-NFC-and-charset-utf8
Filename:
MIME Type:
Creator:
wajasu
Created:
2012-08-23 18:58:03 UTC
Size:
3.43 KB
patch
obsolete
>From c1779df3ca659b2d3031e42863a3bd6132b34478 Mon Sep 17 00:00:00 2001 >From: wajasu <matted-34813@mypacks.net> >Date: Thu, 23 Aug 2012 12:29:19 -0500 >Subject: [PATCH] Bug 8378 - <fine> syntax broken NFC and charset utf8 > >NFC normalize enqueued letters and add content-type charset=utf-8 > >This prevents utf8 codes from causing mysql to truncate the 'content' >from the point of certain codes, when stored in the message_queue table. >This was happenning with the currency symbol generated by >Locale::Currency:Format currency_format routine. NFC normalization >was only done on the attachment content with its content-type >containing "text", as in text/plain. > >For emails AND attachments, the charset="utf-8" was added to the >content-type so mail clients would correctly iterate the utf8 codes, >thus preventing mobijake. >--- > C4/Letters.pm | 17 +++++++++++++++-- > misc/cronjobs/overdue_notices.pl | 3 ++- > 2 files changed, 17 insertions(+), 3 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 4347d8b..b428a91 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -31,6 +31,7 @@ use C4::SMS; > use C4::Debug; > use Date::Calc qw( Add_Delta_Days ); > use Encode; >+use Unicode::Normalize; > use Carp; > > use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); >@@ -762,6 +763,12 @@ sub EnqueueLetter { > return; > } > >+ # It was found that the some utf8 codes, cause the text to be truncated from that point onward when stored, >+ # so we normalize utf8 with NFC so that mysql will store 'all' of the content in its TEXT column type >+ # Note: It is also done in _add_attachments accordingly. >+ $params->{'letter'}->{'title'} = NFC($params->{'letter'}->{'title'}); # subject >+ $params->{'letter'}->{'content'} = NFC($params->{'letter'}->{'content'}); >+ > # If we have any attachments we should encode then into the body. > if ( $params->{'attachments'} ) { > $params->{'letter'} = _add_attachments( >@@ -932,11 +939,17 @@ sub _add_attachments { > $message->attach( > Type => $letter->{'content-type'} || 'TEXT', > Data => $letter->{'is_html'} >- ? _wrap_html($letter->{'content'}, $letter->{'title'}) >- : $letter->{'content'}, >+ ? _wrap_html($letter->{'content'}, NFC($letter->{'title'})) >+ : NFC($letter->{'content'}), > ); > > foreach my $attachment ( @$attachments ) { >+ >+ if ($attachment->{'content'} =~ m/text/o) { # NFC normailze any "text" related content-type attachments >+ $attachment->{'content'} = NFC($attachment->{'content'}); >+ } >+ $attachment->{'filename'} = NFC($attachment->{'filename'}); >+ > $message->attach( > Type => $attachment->{'type'}, > Data => $attachment->{'content'}, >diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl >index 0dc83b1..e83bd39 100755 >--- a/misc/cronjobs/overdue_notices.pl >+++ b/misc/cronjobs/overdue_notices.pl >@@ -609,11 +609,12 @@ END_SQL > > my $attachment = { > filename => defined $csvfilename ? 'attachment.csv' : 'attachment.txt', >- type => 'text/plain', >+ type => 'text/plain; charset="utf-8"', > content => $content, > }; > > my $letter = { >+ 'content-type' => 'text/plain; charset="utf-8"', > title => 'Overdue Notices', > content => 'These messages were not sent directly to the patrons.', > }; >-- >1.7.11.4 >
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 8378
:
11628
|
11804
|
11805
|
11806
|
11906
|
12286
|
14069
|
16387
|
16388
|
16390
|
16407
|
16408
|
16513
|
16515
|
16518
|
16522
|
16528
|
16529
|
16530
|
16531