プロジェクト

全般

プロフィール

Vote #74761

完了

Support more character encodings in incoming emails

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Email receiving_29
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
29
version_id:
75
issue_org_id:
15785
author_id:
3866
assigned_to_id:
0
comments:
19
status_id:
5
tracker_id:
3
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

The @MailHandler@ currently tries to convert the encoding of the body of incoming emails to UTF-8 by directly passing the charset of the email body to @Redmine::CodesetUtil.to_utf8@, see source:/trunk/app/models/mail_handler.rb@12473#L413. @Redmine::CodesetUtil.to_utf8@ in turn only handles encodings known to Ruby (on 1.9+), which might not be the case for the charset of an incoming email.

"Planio":https://plan.io recently had the case of a user sending emails in Korean with the charset @ks_c_5601-1987@, which Ruby doesn't know about. This can be mitigated thanks to "@Mail::RubyVer.pick_encoding@":https://github.com/mikel/mail/blob/2-5-stable/lib/mail/version_specific/ruby_1_9.rb#L99-L141 which will try to pick a Ruby encoding compatible with the charset of the email ("@Mail::RubyVer@":https://github.com/mikel/mail/blob/2-5-stable/lib/mail.rb#L19-L25 is a wrapper for the correct functions for the current Ruby version).

I will post a patch for this shortly.


journals

Here is the patch with a test.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
This patch looks good.
But, Korean encoding detection is in mail 2.5.4.
https://github.com/mikel/mail/commit/88457e66ec5b298bd198b5c3b6739f05320a16ee

Many users posted that mail 2.5.4 has trouble on redmine.org.
For test passes, we need to restrict mail 2.5.4 in Gemfile.
--------------------------------------------------------------------------------
Toshi MARUYAMA wrote:
> This patch looks good.
> But, Korean encoding detection is in mail 2.5.4.
> https://github.com/mikel/mail/commit/88457e66ec5b298bd198b5c3b6739f05320a16ee
This means in mail 2.5.4, not in mail 2.5.3.

--------------------------------------------------------------------------------
It seems Mail::VERSION returns mail version.
https://github.com/mikel/mail/blob/2-5-stable/lib/mail/version.rb
--------------------------------------------------------------------------------
@Mail::VERSION.version@ returns the version of the Mail gem indeed.

I know korean would only work with Mail 2.5.4, and we don't mind requiring it in the Planio Gemfiles to make sure it is supported for us. I think the patch is useful even with earlier versions of the Mail gem, as @Mail::RubyVer.pick_encoding@ is available in earlier versions too and still adds more supported encodings. I agree with you that the test I've written would require Mail 2.5.4 though, you are right.

Should I write a new test that makes sure that the patch works but doesn't require 2.5.4?

Furthermore, what type of errors do users encounter with Mail 2.5.4?
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Felix Schäfer wrote:
> Furthermore, what type of errors do users encounter with Mail 2.5.4?
See #13698.

But Rails 3.2.16 requires mail 2.5.4 or higher.
https://github.com/rails/rails/blame/v3.2.16/actionmailer/actionmailer.gemspec#L23

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Committed in trunk r12474 and tests pass, thanks.
--------------------------------------------------------------------------------
Great to hear, thanks!
--------------------------------------------------------------------------------
Is it duplicate for #14675 ? Can we update our Redmine and get the Defect fixed? =)
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Anton Nepomnyaschih wrote:
> Is it duplicate for #14675 ? Can we update our Redmine and get the Defect fixed? =)

Thank you for your pointing.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------


related_issues

relates,Closed,18047,MailHandler: Don't use String#respond_to?(:force_encoding) to differentiate between Ruby 1.8 and Ruby 1.9

Admin Redmine さんが3年以上前に更新

  • カテゴリEmail receiving_29 にセット
  • 対象バージョン2.5.0_75 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0