diff options
author | ivan <ivan> | 2011-02-17 00:25:23 +0000 |
---|---|---|
committer | ivan <ivan> | 2011-02-17 00:25:23 +0000 |
commit | 0fb307c305e4bc2c9c27dc25a3308beae3a4d33c (patch) | |
tree | 9d527e17db4b4d875f63f019dcd513762bb938a6 /rt/t/mail/wrong_mime_charset.t | |
parent | 6a79fae0c14b6635c67b4f224ee4a14f263b37d0 (diff) | |
parent | fc6209f398899f0211cfcedeb81a3cd65e04a941 (diff) |
This commit was generated by cvs2svn to compensate for changes in r10640,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'rt/t/mail/wrong_mime_charset.t')
-rw-r--r-- | rt/t/mail/wrong_mime_charset.t | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/rt/t/mail/wrong_mime_charset.t b/rt/t/mail/wrong_mime_charset.t new file mode 100644 index 000000000..f53c872e5 --- /dev/null +++ b/rt/t/mail/wrong_mime_charset.t @@ -0,0 +1,25 @@ +#!/usr/bin/perl +use strict; +use warnings; +use RT::Test nodata => 1, tests => 3; + +use_ok('RT::I18N'); +use utf8; +use Encode; +my $test_string = 'À'; +my $encoded_string = encode( 'iso-8859-1', $test_string ); +my $mime = MIME::Entity->build( + Subject => $encoded_string, + Data => [$encoded_string], +); + +# set the wrong charset mime in purpose +$mime->head->mime_attr( "Content-Type.charset" => 'utf8' ); + +RT::I18N::SetMIMEEntityToEncoding( $mime, 'iso-8859-1' ); +my $subject = decode( 'iso-8859-1', $mime->head->get('Subject') ); +chomp $subject; +is( $subject, $test_string, 'subject is set to iso-8859-1' ); +my $body = decode( 'iso-8859-1', $mime->stringify_body ); +chomp $body; +is( $body, $test_string, 'body is set to iso-8859-1' ); |