diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2014-01-01 05:54:28 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2014-01-01 05:54:28 +0000 |
commit | 803a0a030eb59fe1ade70cd9c4b297dbc719fd46 (patch) | |
tree | 4592f3929bde84409ee6284833d10d3aeb5740b7 /app/models/mail_handler.rb | |
parent | 3ace0292c2e45f38aa1df9e737412c1b7303351a (diff) | |
download | redmine-803a0a030eb59fe1ade70cd9c4b297dbc719fd46.tar.gz redmine-803a0a030eb59fe1ade70cd9c4b297dbc719fd46.zip |
support more character encoding in incoming emails (#15785)
Supporting encodings of iconv on Ruby 1.8 depend on iconv implementation.
glibc-common-2.12-1.132 on CentOS6 does not support ks_c_5601-1987.
Contributed by Felix Schäfer.
git-svn-id: http://svn.redmine.org/redmine/trunk@12474 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/mail_handler.rb')
-rw-r--r-- | app/models/mail_handler.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb index c100f8d97..7a4209429 100644 --- a/app/models/mail_handler.rb +++ b/app/models/mail_handler.rb @@ -410,7 +410,11 @@ class MailHandler < ActionMailer::Base part.header[:content_disposition].try(:disposition_type) == 'attachment' end - @plain_text_body = parts.map {|p| Redmine::CodesetUtil.to_utf8(p.body.decoded, p.charset)}.join("\r\n") + @plain_text_body = parts.map do |p| + body_charset = p.charset.respond_to?(:force_encoding) ? + Mail::RubyVer.pick_encoding(p.charset).to_s : p.charset + Redmine::CodesetUtil.to_utf8(p.body.decoded, body_charset) + end.join("\r\n") # strip html tags and remove doctype directive if parts.any? {|p| p.mime_type == 'text/html'} |