Patch #15785 » 15785.patch
app/models/mail_handler.rb | ||
---|---|---|
410 | 410 |
part.header[:content_disposition].try(:disposition_type) == 'attachment' |
411 | 411 |
end |
412 | 412 | |
413 |
@plain_text_body = parts.map {|p| Redmine::CodesetUtil.to_utf8(p.body.decoded, p.charset)}.join("\r\n")
|
|
413 |
@plain_text_body = parts.map {|p| Redmine::CodesetUtil.to_utf8(p.body.decoded, Mail::RubyVer.pick_encoding(p.charset).to_s)}.join("\r\n")
|
|
414 | 414 | |
415 | 415 |
# strip html tags and remove doctype directive |
416 | 416 |
if parts.any? {|p| p.mime_type == 'text/html'} |
test/fixtures/mail_handler/body_ks_c_5601-1987.eml | ||
---|---|---|
1 |
From: John Smith <JSmith@somenet.foo> |
|
2 |
To: "redmine@somenet.foo" <redmine@somenet.foo> |
|
3 |
Subject: This is a test |
|
4 |
Content-Type: multipart/alternative; |
|
5 |
boundary="_c20d9cfa-d16a-43a3-a7e5-71da7877ab23_" |
|
6 | ||
7 |
--_c20d9cfa-d16a-43a3-a7e5-71da7877ab23_ |
|
8 |
Content-Type: text/plain; charset="ks_c_5601-1987" |
|
9 |
Content-Transfer-Encoding: base64 |
|
10 | ||
11 |
sO24v73AtM+02S4= |
|
12 | ||
13 |
--_c20d9cfa-d16a-43a3-a7e5-71da7877ab23_-- |
|
14 |
test/unit/mail_handler_test.rb | ||
---|---|---|
538 | 538 |
assert_equal ja, issue.subject |
539 | 539 |
end |
540 | 540 | |
541 |
def test_add_issue_with_korean_body |
|
542 |
# Make sure mail bodies with a charset unknown to Ruby but known to the |
|
543 |
# Mail gem are handled correctly |
|
544 | ||
545 |
issue = submit_email( |
|
546 |
'body_ks_c_5601-1987.eml', |
|
547 |
:issue => {:project => 'ecookbook'} |
|
548 |
) |
|
549 | ||
550 |
assert_kind_of Issue, issue |
|
551 | ||
552 |
kr = "\xEA\xB3\xA0\xEB\xA7\x99\xEC\x8A\xB5\xEB\x8B\x88\xEB\x8B\xA4." |
|
553 |
kr.force_encoding('UTF-8') if kr.respond_to?(:force_encoding) |
|
554 |
assert_equal kr, issue.description |
|
555 |
end |
|
556 | ||
541 | 557 |
def test_add_issue_with_no_subject_header |
542 | 558 |
issue = submit_email( |
543 | 559 |
'no_subject_header.eml', |