[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.8-57-g16391db

? sunnavy sunnavy at bestpractical.com
Thu May 20 04:35:19 EDT 2010


The branch, 3.8-trunk has been updated
       via  16391db0bc59397ad4735985446cec74315791f2 (commit)
      from  3e10e09d9118e14b8e4d6e4cccbc0951db7a18d1 (commit)

Summary of changes:
 t/mail/wrong_mime_charset.t |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
 create mode 100644 t/mail/wrong_mime_charset.t

- Log -----------------------------------------------------------------
commit 16391db0bc59397ad4735985446cec74315791f2
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu May 20 16:35:35 2010 +0800

    add test for wrong mime charset

diff --git a/t/mail/wrong_mime_charset.t b/t/mail/wrong_mime_charset.t
new file mode 100644
index 0000000..f53c872
--- /dev/null
+++ b/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' );

-----------------------------------------------------------------------


More information about the Rt-commit mailing list