[rt-users] Encoding Troubles with RT 3.8.8

benoit plessis plessis.benoit at gmail.com
Wed Aug 4 09:58:05 EDT 2010


2010/8/4 benoit plessis <plessis.benoit at gmail.com>:
> Hi,
>
> I've some problems with iso-8859-1/utf8 encoding of outbound mail with RT.
>
.....
> Also, there is a similar problem when using html mail/template,
> accentuated chars are converted to iso-8859-1 chars for the
> "text/plain" version of the mail with is send with an utf8 headers.
> The text/html part contain the html-entity codes so there is no problem.
>
> When not using html templates entities are correctly converted using
> utf8 charset.
>

For this part, in _DowngradeFromHTML there is two thing:
  * forced 'utf8' mime charset, why not using "EmailOutputEncoding"
  * use of HTML::FormatText which can only generate latin1 text


    my $charset = RT->Config->Get('EmailOutputEncoding');

    my $new_entity = $orig_entity->dup; # this will fail badly if we
go away from InCore parsing
    $new_entity->head->mime_attr( "Content-Type" => 'text/plain' );
    $new_entity->head->mime_attr( "Content-Type.charset" => $charset );

    $orig_entity->head->mime_attr( "Content-Type" => 'text/html' );
    $orig_entity->head->mime_attr( "Content-Type.charset" => $charset );
    $orig_entity->make_multipart('alternative', Force => 1);

    require HTML::FormatText;
    require HTML::TreeBuilder;
    require Encode;
    my $tree = HTML::TreeBuilder->new_from_content(
        $new_entity->bodyhandle->as_string
    );
    $new_entity->bodyhandle(MIME::Body::InCore->new(
        \(
         Encode::from_to(scalar HTML::FormatText->new(
            leftmargin  => 0,
            rightmargin => 78,
        )->format( $tree ),
        'iso-8859-1' => $charset
         )
      )
    ));
    $tree->delete;
    ....



More information about the rt-users mailing list