[Rt-commit] r19599 - rt/3.8/branches/forward-with-transaction/share/html/Ticket/Attachment/WithHeaders

falcone at bestpractical.com falcone at bestpractical.com
Fri May 8 17:57:15 EDT 2009


Author: falcone
Date: Fri May  8 17:57:13 2009
New Revision: 19599

Modified:
   rt/3.8/branches/forward-with-transaction/share/html/Ticket/Attachment/WithHeaders/dhandler

Log:
When downloading message with headers, try to add charset information to
content_type so the raw message is displayed correctly in browser.

Modified: rt/3.8/branches/forward-with-transaction/share/html/Ticket/Attachment/WithHeaders/dhandler
==============================================================================
--- rt/3.8/branches/forward-with-transaction/share/html/Ticket/Attachment/WithHeaders/dhandler	(original)
+++ rt/3.8/branches/forward-with-transaction/share/html/Ticket/Attachment/WithHeaders/dhandler	Fri May  8 17:57:13 2009
@@ -59,8 +59,16 @@
         Abort("Couldn't load attachment #$id");
     }
 
+    my $content_type = 'text/plain';
+    if ( my $enc = $AttachmentObj->OriginalEncoding ) {
+        # normalize Encode.pm convention with IANA ones
+        $enc = 'big5'  if $enc eq 'big5-eten';
+        $enc = 'utf-8' if $enc eq 'utf8';
+        $content_type .= ";charset=$enc";
+    }
+
     # XXX: should we check handle html here and integrate headers into html?
-    $r->content_type( 'text/plain' );
+    $r->content_type( $content_type );
     $m->clear_buffer;
     $m->out( $AttachmentObj->Headers );
     $m->out( "\n\n" );


More information about the Rt-commit mailing list