View | Details | Raw Unified | Return to bug 8378
Collapse All | Expand All

(-)a/C4/Letters.pm (-2 / +15 lines)
Lines 31-36 use C4::SMS; Link Here
31
use C4::Debug;
31
use C4::Debug;
32
use Date::Calc qw( Add_Delta_Days );
32
use Date::Calc qw( Add_Delta_Days );
33
use Encode;
33
use Encode;
34
use Unicode::Normalize;
34
use Carp;
35
use Carp;
35
36
36
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
37
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
Lines 762-767 sub EnqueueLetter { Link Here
762
        return;
763
        return;
763
    }
764
    }
764
765
766
    # It was found that the some utf8 codes, cause the text to be truncated from that point onward when stored,
767
    # so we normalize utf8 with NFC so that mysql will store 'all' of the content in its TEXT column type
768
    # Note: It is also done in _add_attachments accordingly.
769
    $params->{'letter'}->{'title'} = NFC($params->{'letter'}->{'title'});     # subject
770
    $params->{'letter'}->{'content'} = NFC($params->{'letter'}->{'content'});
771
765
    # If we have any attachments we should encode then into the body.
772
    # If we have any attachments we should encode then into the body.
766
    if ( $params->{'attachments'} ) {
773
    if ( $params->{'attachments'} ) {
767
        $params->{'letter'} = _add_attachments(
774
        $params->{'letter'} = _add_attachments(
Lines 932-942 sub _add_attachments { Link Here
932
    $message->attach(
939
    $message->attach(
933
        Type => $letter->{'content-type'} || 'TEXT',
940
        Type => $letter->{'content-type'} || 'TEXT',
934
        Data => $letter->{'is_html'}
941
        Data => $letter->{'is_html'}
935
            ? _wrap_html($letter->{'content'}, $letter->{'title'})
942
            ? _wrap_html($letter->{'content'}, NFC($letter->{'title'}))
936
            : $letter->{'content'},
943
            : NFC($letter->{'content'}),
937
    );
944
    );
938
945
939
    foreach my $attachment ( @$attachments ) {
946
    foreach my $attachment ( @$attachments ) {
947
948
        if ($attachment->{'content'} =~ m/text/o) { # NFC normailze any "text" related  content-type attachments
949
            $attachment->{'content'} = NFC($attachment->{'content'});
950
        }
951
        $attachment->{'filename'} = NFC($attachment->{'filename'});
952
940
        $message->attach(
953
        $message->attach(
941
            Type     => $attachment->{'type'},
954
            Type     => $attachment->{'type'},
942
            Data     => $attachment->{'content'},
955
            Data     => $attachment->{'content'},
(-)a/misc/cronjobs/overdue_notices.pl (-2 / +2 lines)
Lines 609-619 END_SQL Link Here
609
            
609
            
610
        my $attachment = {
610
        my $attachment = {
611
            filename => defined $csvfilename ? 'attachment.csv' : 'attachment.txt',
611
            filename => defined $csvfilename ? 'attachment.csv' : 'attachment.txt',
612
            type => 'text/plain',
612
            type => 'text/plain; charset="utf-8"',
613
            content => $content, 
613
            content => $content, 
614
        };
614
        };
615
615
616
        my $letter = {
616
        my $letter = {
617
            'content-type' => 'text/plain; charset="utf-8"',
617
            title   => 'Overdue Notices',
618
            title   => 'Overdue Notices',
618
            content => 'These messages were not sent directly to the patrons.',
619
            content => 'These messages were not sent directly to the patrons.',
619
        };
620
        };
620
- 

Return to bug 8378