[open-ils-commits] r19547 - branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Mar 1 00:33:29 EST 2011


Author: dbs
Date: 2011-03-01 00:33:25 -0500 (Tue, 01 Mar 2011)
New Revision: 19547

Modified:
   branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm
Log:
Add a TT helper to encode email headers in UTF-8

This can and should be used to encode any headers (To, From, Subject, etc)
in an email that might include text outside of the ASCII 7-bit range. Names
of people or libraries, for example, that might otherwise come out garbled.


Modified: branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm
===================================================================
--- branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm	2011-03-01 04:16:07 UTC (rev 19546)
+++ branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm	2011-03-01 05:33:25 UTC (rev 19547)
@@ -1,5 +1,6 @@
 package OpenILS::Application::Trigger::Reactor;
 use strict; use warnings;
+use Encode qw/ encode /;
 use Template;
 use DateTime;
 use DateTime::Format::ISO8601;
@@ -49,6 +50,13 @@
         return $str;
     },
 
+    # encode email headers in UTF-8, per RFC2231
+    escape_email_header => sub {
+        my $str = shift;
+        $str = encode("MIME-Header", $str);
+        return $str;
+    },
+
     # strip non-ASCII characters after splitting base characters and diacritics
     # least common denominator for EDIFACT messages using the UNOB character set
     force_jedi_unob => sub {



More information about the open-ils-commits mailing list