X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Ft%2Fmail%2Fwrong_mime_charset.t;h=a3986d72f0c5c9d20657f31187c178fc9fd3f383;hb=refs%2Fheads%2FFREESIDE_4_BRANCH;hp=530b5f38de4dbb82cf71105a481750c8397f77b0;hpb=3d0a1bb06b895c5be6e3f0517d355442a6b1e125;p=freeside.git diff --git a/rt/t/mail/wrong_mime_charset.t b/rt/t/mail/wrong_mime_charset.t index 530b5f38d..a3986d72f 100644 --- a/rt/t/mail/wrong_mime_charset.t +++ b/rt/t/mail/wrong_mime_charset.t @@ -1,12 +1,10 @@ use strict; use warnings; -use RT::Test nodb => 1, tests => 6; +use RT::Test nodb => 1, tests => undef; use_ok('RT::I18N'); -use utf8; -use Encode; -my $test_string = 'À'; -my $encoded_string = encode( 'iso-8859-1', $test_string ); +my $test_string = Encode::decode("UTF-8", 'À'); +my $encoded_string = Encode::encode( 'iso-8859-1', $test_string ); my $mime = MIME::Entity->build( "Subject" => $encoded_string, "Data" => [$encoded_string], @@ -22,10 +20,6 @@ local $SIG{__WARN__} = sub { RT::I18N::SetMIMEEntityToEncoding( $mime, 'iso-8859-1' ); -TODO: { - local $TODO = -'need a better approach of encoding converter, should be fixed in 4.2'; - # this is a weird behavior for different perl versions, 5.12 warns twice, # which is correct since we do the encoding thing twice, for Subject # and Data respectively. @@ -40,10 +34,11 @@ like( "We can't encode something into the wrong encoding without Encode complaining" ); -my $subject = decode( 'iso-8859-1', $mime->head->get('Subject') ); +my $subject = Encode::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 ); +my $body = Encode::decode( 'iso-8859-1', $mime->stringify_body ); chomp $body; is( $body, $test_string, 'body is set to iso-8859-1' ); -} + +done_testing;