[Rt-commit] rt branch, 4.2-trunk, updated. rt-4.2.9-135-gca64a56

Alex Vandiver alexmv at bestpractical.com
Wed Feb 4 13:38:33 EST 2015


The branch, 4.2-trunk has been updated
       via  ca64a561d36331b8322e4de1296a465bb58e049c (commit)
      from  b01f8750b01e65456ed58dd82b67504ec52751bc (commit)

Summary of changes:
 lib/RT/Interface/Email.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

- Log -----------------------------------------------------------------
commit ca64a561d36331b8322e4de1296a465bb58e049c
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Feb 4 13:32:41 2015 -0500

    Explicitly encode the HTML before passing it to external programs
    
    HTML::FormatExternal prints the data that it recieves to the external
    program, without explicitly applying an encoding -- that is, it takes
    bytes, not characters.  When perl attempts to use "print" to send these
    to the external program, it (correctly) produces "wide character in
    print" warnings.
    
    Explicitly encode the HTML to format as UTF-8 before sending it over the
    wire; this makes perl's internal representation of the characters
    irrelevant, and squashes the wide character warnings.

diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index b1ac2bd..5c7c71e 100644
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -1858,7 +1858,10 @@ sub _HTMLFormatter {
                     local $ENV{PATH} = $path || $ENV{PATH}
                         || '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin';
                     local $ENV{HOME} = $RT::VarPath;
-                    $package->format_string($html, leftmargin => 0, rightmargin => 78);
+                    $package->format_string(
+                        Encode::encode( "UTF-8", $html),
+                        leftmargin => 0, rightmargin => 78
+                    );
                 };
             };
         }

-----------------------------------------------------------------------


More information about the rt-commit mailing list