From: Galen Charlton Date: Fri, 3 Jan 2020 22:55:10 +0000 (-0500) Subject: LP#1801163: (follow-up) deal with header fields that contain Unicode strings X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0fd0ed29d1b292eb39e33dbe71464973922bcb6f;p=evergreen%2Ftadl.git LP#1801163: (follow-up) deal with header fields that contain Unicode strings Since Email::MIME->header_str_set() expects Unicode strings, not octets, use decode_utf8() on the header values to To test ------- [1] Update the biblio.format.record_entry.print A/T event definition to include non-ASCII characters in the subject and from headers. [2] Upon applying the patch series, verifying that the strings provided in step 1 are not mangled when the email is sent. Signed-off-by: Galen Charlton Signed-off-by: Jason Boyer --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/SendEmail.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/SendEmail.pm index 675ab69cde..8f7a3219ca 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/SendEmail.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/SendEmail.pm @@ -62,13 +62,13 @@ sub handler { # properly, we make sure there is only 1 each. for my $hfield (qw/From To Bcc Cc Reply-To Sender/) { my @headers = $email->header($hfield); - $email->header_str_set($hfield => join(',', @headers)) if ($headers[0]); + $email->header_str_set($hfield => decode_utf8(join(',', @headers))) if ($headers[0]); } # Handle the Subject field. Again, the standard says there can be # only one. my @headers = $email->header('Subject'); - $email->header_str_set('Subject' => $headers[0]) if ($headers[0]); + $email->header_str_set('Subject' => decode_utf8($headers[0])) if ($headers[0]); $email->header_set('MIME-Version' => '1.0'); $email->header_set('Content-Type' => "text/plain; charset=UTF-8");