[rt-users] RT 3.8 mangles html attachment

Todd Chapman todd at chaka.net
Fri Feb 20 14:46:49 EST 2009


The attached script and input file trigger the error. I think the
problem is the loop on @lines. The BOM is only in the first line so
the rest is cornfused.



On Fri, Feb 20, 2009 at 1:43 PM, Jesse Vincent <jesse at bestpractical.com> wrote:
>> Hmmm. Just noticed this error:
>>
>> [Fri Feb 20 18:32:55 2009] [debug]: Converting 'UTF-16' to 'utf-8' for
>> text/html - Re Eprize RPC interface failing on DC registration.htm
>> (/opt/rt3-devel/bin/../lib/RT/I18N.pm:234)
>> [Fri Feb 20 18:32:55 2009] [error]: Encoding error:
>> UTF-16:Unrecognised BOM 78 at
>> /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/Encode.pm line 190.
>
> How small a test case can you get to fail like that?
>
-------------- next part --------------
use strict;
use warnings;

use RT;
RT::LoadConfig();
RT::Init();

use MIME::Entity;
use RT::I18N;

    my $Message = MIME::Entity->build(
        Type    => 'multipart/mixed',
        Subject => "foo",
    );  


open(my $filehandle, "<", "file") or die;

my (@content,$buffer);
while ( my $bytesread = read( $filehandle, $buffer, 4096 ) ) {
    push @content, $buffer;
}

$Message->attach(
    Type     => "text/html",
    Filename => 'myfile',
    Data     => \@content,
);

$Message->make_singlepart;
RT::I18N::SetMIMEEntityToUTF8($Message); # convert text parts into utf-8
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file
Type: application/octet-stream
Size: 40 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20090220/f31e3379/attachment.obj>


More information about the rt-users mailing list