diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-06-04 15:12:36 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-06-04 15:12:36 +0100 |
commit | 1d64718b8eb0fa63bcf6d3853f4bda7b15eb4427 (patch) | |
tree | ae425fa3cebe8295af47d288898728c0d764b926 /spec/lib | |
parent | 7b9fc0f82acfee43bc42a080f8a1e64c23604a65 (diff) | |
parent | a919141992a40599f99b32bd4a8312a0009f3f7a (diff) |
Merge branch 'release/0.11' into rails-3-develop
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/mail_handler/mail_handler_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/lib/mail_handler/mail_handler_spec.rb b/spec/lib/mail_handler/mail_handler_spec.rb index 01bf179f8..272b56d0b 100644 --- a/spec/lib/mail_handler/mail_handler_spec.rb +++ b/spec/lib/mail_handler/mail_handler_spec.rb @@ -32,6 +32,19 @@ describe 'when creating a mail object from raw data' do MailHandler.get_part_body(mail).is_utf8?.should == true end + it 'should not be confused by subject lines with malformed UTF-8 at the end' do + # The base64 subject line was generated with: + # printf "hello\360" | base64 + # ... and wrapping the result in '=?UTF-8?B?' and '?=' + mail = get_fixture_mail('subject-bad-utf-8-trailing-base64.email') + mail.subject.should == 'hello' + # The quoted printable subject line was generated with: + # printf "hello\360" | qprint -b -e + # ... and wrapping the result in '=?UTF-8?Q?' and '?=' + mail = get_fixture_mail('subject-bad-utf-8-trailing-quoted-printable.email') + mail.subject.should == 'hello' + end + it 'should convert a Windows-1252 body mislabelled as ISO-8859-1 to UTF-8' do mail = get_fixture_mail('mislabelled-as-iso-8859-1.email') body = MailHandler.get_part_body(mail) @@ -465,3 +478,11 @@ describe 'when getting attachment attributes' do end end end + +describe 'when getting the address part from an address string' do + + it 'should handle non-ascii characters in the name input' do + address = "\"Someone’s name\" <test@example.com>" + MailHandler.address_from_string(address).should == 'test@example.com' + end +end |