diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-05-06 10:39:00 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-05-06 10:39:00 +0000 |
commit | 483931ea615d49a31d6de225f273e0945ad6cbb3 (patch) | |
tree | db2c3f955ca855a78582d32ef7cd4b188a4fee95 /actionmailer/test | |
parent | c971c248394c7d603d336e31457c51ca33edf67d (diff) | |
download | rails-483931ea615d49a31d6de225f273e0945ad6cbb3.tar.gz rails-483931ea615d49a31d6de225f273e0945ad6cbb3.tar.bz2 rails-483931ea615d49a31d6de225f273e0945ad6cbb3.zip |
Fixed the TMail#body method to look at the content-transfer-encoding header and unquote the body according to the rules it specifies #1265 [Jamis Buck] Added unquoting even if the iconv lib can't be loaded--in that case, only the charset conversion is skipped #1265 [Jamis Buck]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1290 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionmailer/test')
-rwxr-xr-x | actionmailer/test/mail_service_test.rb | 62 |
1 files changed, 57 insertions, 5 deletions
diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index 04fa6bde1f..4863c9b4f4 100755 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -240,20 +240,72 @@ class ActionMailerTest < Test::Unit::TestCase assert_equal 1, ActionMailer::Base.deliveries.size end - def test_unquote_subject + def test_unquote_quoted_printable_subject msg = <<EOF From: me@example.com Subject: =?utf-8?Q?testing_testing_=D6=A4?= Content-Type: text/plain; charset=iso-8859-1 -This_is_a_test -2 + 2 =3D 4 +The body EOF mail = TMail::Mail.parse(msg) assert_equal "testing testing \326\244", mail.subject assert_equal "=?utf-8?Q?testing_testing_=D6=A4?=", mail.quoted_subject - assert_equal "This is a test\n2 + 2 = 4\n", mail.body - assert_equal "This_is_a_test\n2 + 2 =3D 4\n", mail.quoted_body + end + + def test_unquote_7bit_subject + msg = <<EOF +From: me@example.com +Subject: this == working? +Content-Type: text/plain; charset=iso-8859-1 + +The body +EOF + mail = TMail::Mail.parse(msg) + assert_equal "this == working?", mail.subject + assert_equal "this == working?", mail.quoted_subject + end + + def test_unquote_7bit_body + msg = <<EOF +From: me@example.com +Subject: subject +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 7bit + +The=3Dbody +EOF + mail = TMail::Mail.parse(msg) + assert_equal "The=3Dbody", mail.body.strip + assert_equal "The=3Dbody", mail.quoted_body.strip + end + + def test_unquote_quoted_printable_body + msg = <<EOF +From: me@example.com +Subject: subject +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: quoted-printable + +The=3Dbody +EOF + mail = TMail::Mail.parse(msg) + assert_equal "The=body", mail.body.strip + assert_equal "The=3Dbody", mail.quoted_body.strip + end + + def test_unquote_base64_body + msg = <<EOF +From: me@example.com +Subject: subject +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: base64 + +VGhlIGJvZHk= +EOF + mail = TMail::Mail.parse(msg) + assert_equal "The body", mail.body.strip + assert_equal "VGhlIGJvZHk=", mail.quoted_body.strip end def test_extended_headers |