diff --git a/test/fixtures/mail_handler/ticket_with_utf8_body_and_lf_line_terminator.eml b/test/fixtures/mail_handler/ticket_with_utf8_body_and_lf_line_terminator.eml new file mode 100644 index 000000000..80601da51 --- /dev/null +++ b/test/fixtures/mail_handler/ticket_with_utf8_body_and_lf_line_terminator.eml @@ -0,0 +1,18 @@ +Return-Path: +Received: from osiris ([127.0.0.1]) + by OSIRIS + with hMailServer ; Sun, 22 Jun 2008 12:28:07 +0200 +Message-ID: <000501c8d452$a95cd7e0$0a00a8c0@osiris> +From: "John Smith" +To: +Subject: New ticket on UTF-8 body and LF line terminator +Date: Sun, 22 Jun 2008 12:28:07 +0200 +MIME-Version: 1.0 +Content-Type: text/plain; + format=flowed; + charset="utf-8"; + reply-type=original +Content-Transfer-Encoding: 8bit + +Hello +こんにちは diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb index 51219d65e..d934f607b 100644 --- a/test/unit/mail_handler_test.rb +++ b/test/unit/mail_handler_test.rb @@ -1164,6 +1164,20 @@ class MailHandlerTest < ActiveSupport::TestCase assert_equal false, MailHandler.safe_receive end + def test_add_issue_with_utf8_body_and_lf_line_terminator + issue = + submit_email('ticket_with_utf8_body_and_lf_line_terminator.eml', + :issue => {:project => 'ecookbook'} + ) do |email| + # Ensure that line terminators are LF + email.gsub!("\r\n", "\n") + end + assert issue.is_a?(Issue) + issue.reload + assert_equal 'New ticket on UTF-8 body and LF line terminator', issue.subject + assert_equal "Hello\r\nこんにちは", issue.description + end + private def submit_email(filename, options={})