##// END OF EJS Templates
fix receiving mail subject broken which does not begin with encoding name (#12375)...
Toshi MARUYAMA -
r10585:617cb7ac53ee
parent child
Show More
@@ -0,0 +1,7
1 From: John Smith <JSmith@somenet.foo>
2 To: "redmine@somenet.foo" <redmine@somenet.foo>
3 Subject: Re: =?iso-2022-jp?b?GyRCJUYlOSVIGyhCCg=?=
4 Date: Fri, 1 Jun 2012 14:39:38 +0200
5 Message-ID: <87C31D42249DD0489D1A1444E3232DD7019D6183@foo.bar>
6
7 Fixture
@@ -377,7 +377,8 class MailHandler < ActionMailer::Base
377 # try to reencode to utf8 manually with ruby1.8
377 # try to reencode to utf8 manually with ruby1.8
378 begin
378 begin
379 if h = email.header[:subject]
379 if h = email.header[:subject]
380 if m = h.value.match(/^=\?([^\?]+)\?/)
380 # http://tools.ietf.org/html/rfc2047#section-4
381 if m = h.value.match(/=\?([^\?]+)\?[BbQq]\?/)
381 subject = Redmine::CodesetUtil.to_utf8(subject, m[1])
382 subject = Redmine::CodesetUtil.to_utf8(subject, m[1])
382 end
383 end
383 end
384 end
@@ -393,6 +393,17 class MailHandlerTest < ActiveSupport::TestCase
393 assert_equal ja, issue.subject
393 assert_equal ja, issue.subject
394 end
394 end
395
395
396 def test_add_issue_with_mixed_japanese_subject
397 issue = submit_email(
398 'subject_japanese_2.eml',
399 :issue => {:project => 'ecookbook'}
400 )
401 assert_kind_of Issue, issue
402 ja = "Re: \xe3\x83\x86\xe3\x82\xb9\xe3\x83\x88"
403 ja.force_encoding('UTF-8') if ja.respond_to?(:force_encoding)
404 assert_equal ja, issue.subject
405 end
406
396 def test_should_ignore_emails_from_locked_users
407 def test_should_ignore_emails_from_locked_users
397 User.find(2).lock!
408 User.find(2).lock!
398
409
General Comments 0
You need to be logged in to leave comments. Login now