[open-ils-commits] r19546 - trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Feb 28 23:16:10 EST 2011


Author: dbs
Date: 2011-02-28 23:16:07 -0500 (Mon, 28 Feb 2011)
New Revision: 19546

Modified:
   trunk/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: trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm	2011-02-25 21:33:46 UTC (rev 19545)
+++ trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm	2011-03-01 04:16:07 UTC (rev 19546)
@@ -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