[Rt-commit] r13509 - rt/3.8/branches/non-ascii-subject/lib/RT

ruz at bestpractical.com ruz at bestpractical.com
Fri Jun 20 23:16:24 EDT 2008


Author: ruz
Date: Fri Jun 20 23:16:23 2008
New Revision: 13509

Modified:
   rt/3.8/branches/non-ascii-subject/lib/RT/Template_Overlay.pm

Log:
* ok, MIME::Parser is not aware about perl strings, so we use octets.
  What means that we must treat MIME's content as octets everywhere
  and use Encode::decode_utf8

Modified: rt/3.8/branches/non-ascii-subject/lib/RT/Template_Overlay.pm
==============================================================================
--- rt/3.8/branches/non-ascii-subject/lib/RT/Template_Overlay.pm	(original)
+++ rt/3.8/branches/non-ascii-subject/lib/RT/Template_Overlay.pm	Fri Jun 20 23:16:23 2008
@@ -358,10 +358,10 @@
     ### Should we forgive normally-fatal errors?
     $parser->ignore_errors(1);
 
-    open my $stream, "<:utf8", \$content
-        or return (0, $self->loc("Couldn't open stream for parsing MIME::Entity: $!"));
+    # MIME::Parser doesn't play well with perl strings
+    utf8::encode($content);
 
-    $self->{'MIMEObj'} = eval { $parser->parse( $stream ) };
+    $self->{'MIMEObj'} = eval { $parser->parse_data( \$content ) };
     if ( my $error = $@ || $parser->last_error ) {
         $RT::Logger->error( "$error" );
         return ( 0, $error );


More information about the Rt-commit mailing list