プロジェクト

全般

プロフィール

Vote #79482

完了

Vendor-defined characters in ISO-2022-JP email subject break issue's subject

Admin Redmine さんが約4年前に追加. 約4年前に更新.

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

0%

予定工数:
category_id:
29
version_id:
99
issue_org_id:
29442
author_id:
332
assigned_to_id:
332
comments:
3
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

When you create an issue via email, the subject field in the issue will be broken if the subject line in the email is encoded with ISO-2022-JP and contains vendor-defined characters such as "①".

Suppose a user is trying to create an issue via email with the subject "①丸数字テスト" and it is encoded with ISO-2022-JP. Actually, the subject field of the issue will be "$B-!(B $B4]?t;z%F%9%H(B".

!{width: 283px; border: 1px solid #ccc;}.broken-subject@2x.png!

This is because the email's subject contains the character "①". The CIRCLED DIGIT ONE character, U+2460 in Unicode, is not defined in ISO-2022-JP. But it is defined in some vendor-extended variants like ISO-2022-JP-MS and widely used in the real world. Probably Ruby would not process "①" in ISO-2022-JP and raises @Encoding::UndefinedConversionError@.

The undefined character "①" should be replaced with the replacement character instead of breaking the whole subject. Please see ":undef" and ":replace" option of String#encode in http://ruby-doc.org/core-2.5.1/String.html#method-i-encode.

The attached patch is a test to detect the problem.

$ ruby test/unit/mail_handler_test.rb
    .
  (snip)
    .
Encoding conversion failed "\xAD\xA1" to UTF-8 in conversion from ISO-2022-JP to stateless-ISO-2022-JP to EUC-JP to UTF-8
Encoding conversion failed "\xAD\xA1" to UTF-8 in conversion from ISO-2022-JP to stateless-ISO-2022-JP to EUC-JP to UTF-8
Encoding conversion failed "\xAD\xA1" to UTF-8 in conversion from ISO-2022-JP to stateless-ISO-2022-JP to EUC-JP to UTF-8
Encoding conversion failed "\xAD\xA1" to UTF-8 in conversion from ISO-2022-JP to stateless-ISO-2022-JP to EUC-JP to UTF-8
F

Failure:
MailHandlerTest#test_add_issue_with_iso_2022_jp_ms_subject [test/unit/mail_handler_test.rb:753]:
Expected /丸数字テスト/ to match "\e$B-!\e(B \e$B4]?t;z%F%9%H\e(B".


bin/rails test test/unit/mail_handler_test.rb:742

journals

It will be fixed if we update mail gem to 2.7.0. See https://github.com/mikel/mail/pull/978 for details.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
This issue has been fixed by #29443.
--------------------------------------------------------------------------------


related_issues

blocks,Closed,29443,Update mail gem (~> 2.7.1)

Admin Redmine さんが約4年前に更新

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

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

いいね!0
いいね!0