Project

General

Profile

Actions

Defect #3592

open

Unreadable quoted-printable utf-8 long subject in some mail clients

Added by Stanislav German-Evtushenko over 15 years ago. Updated about 10 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Email notifications
Target version:
-
Start date:
2009-07-07
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

Subject becomes undreadable in groupwise 7.0.3 when it's quoted-printable and longer ~80 chars. This patch converts subject to base64 instead of quoted-printable.


Files

mailer-subject-base64.patch (511 Bytes) mailer-subject-base64.patch Stanislav German-Evtushenko, 2009-07-07 08:24
mailer-long-subject-base64.patch (314 Bytes) mailer-long-subject-base64.patch This patch converts subject to base64 and handles the 76 chars limit. Maxim Verevkin, 2010-02-12 09:43
mailresult.png (15.2 KB) mailresult.png the subject of the mail has truned lee min, 2014-08-27 10:02

Related issues

Related to Redmine - Defect #8658: uncorrect subject on mail notificationClosed2011-06-21

Actions
Related to Redmine - Defect #16859: rdm-mailhandler: subject corruptionClosed

Actions
Has duplicate Redmine - Defect #3601: Problem in issue subject and notificationClosedAzamat Hackimov2009-07-092009-07-13

Actions
Has duplicate Redmine - Defect #17752: mail subject come to unreadable code when it's too longClosed

Actions
Actions #1

Updated by Stanislav German-Evtushenko over 15 years ago

Here subject is for example:

Re: =?utf-8?Q?=5b=d0=97=d0=b0=d1=8f=d0=b2=d0=ba=d0=b8_=d0=b2_=d0=be=d1=82=d0=b4=d0=b5=d0=bb_IT_=2d_=d0=97=d0=b0=d1=8f=d0=b2=d0=ba=d0=b0_=23=39=36=5d_=d0=97=d0=b0=d0=ba=d0=b0=d0=b7_=d0=b2_=d0=bf=d1=80=d0=be=d0=b8=d0=b7=d0=b2=d0=be=d0=b4=d1=81=d1=82=d0=b2=d0=be_=e2=84=96_=38=34?=

Actions #2

Updated by Konstantin Zaitsev over 15 years ago

Thank You, for patch

Actions #3

Updated by Azamat Hackimov over 15 years ago

Looks good for me, but I'm going to try also with CJK-langs...

Actions #4

Updated by Stanislav German-Evtushenko over 15 years ago

Huh, the problem is still unresolved. Base64 allows to put more chars in subject but there is a limit too. I have done some investigation and here what I found.
Thunderbird is doing something like that (it's displayed normaly in groupwise):

Subject: =?UTF-8?B?0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB?=
 =?UTF-8?B?0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YI=?=
 =?UTF-8?B?INGC0LXRgdGCINGC0LXRgdGCINGC0LXRgdGCINGC0LXRgdGCINGC0LXRgdGCINGC?=
 =?UTF-8?B?0LXRgdGCINGC0LXRgdGCINGC0LXRgdGCINGC0LXRgdGCINGC0LXRgdGCINGC0LU=?=
 =?UTF-8?B?0YHRgiDRgtC10YHRgiDRgtC10YHRgiDRgtC10YHRgiDRgtC10YHRgiDRgtC10YE=?=
 =?UTF-8?B?0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YI=?=
 =?UTF-8?B?INGC0LXRgdGCINGC0LXRgdGCINGC0LXRgdGCINGC0LXRgdGCINGC0LXRgdGCINGC?=
 =?UTF-8?B?0LXRgdGCINGC0LXRgdGCINGC0LXRgdGCINGC0LXRgdGCINGC0LXRgdGCINGC0LU=?=
 =?UTF-8?B?0YHRgiDRgtC10YHRgiDRgtC10YHRgiDRgtC10YHRgiDRgtC10YHRgiDRgtC10YE=?=
 =?UTF-8?B?0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YI=?=

But actionmailer like that (base64):

Subject: =?UTF-8?B?0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIg0YLQtdGB0YIK?=

or like that (quoted-printable):

Subject: =?UTF-8?Q?=5b=d0=97=d0=b0=d1=8f=d0=b2=d0=ba=d0=b8_=d0=b2_=d0=be=d1=82=d0=b4=d0=b5=d0=bb_IT_=2d_=d0=97=d0=b0=d1=8f=d0=b2=d0=ba=d0=b0_=23=39=36=5d_=d0=97=d0=b0=d0=ba=d0=b0=d0=b7_=d0=b2_=d0=bf=d1=80=d0=be=d0=b8=d0=b7=d0=b2=d0=be=d0=b4=d1=81=d1=82=d0=b2=d0=be_=e2=84=96_=38=34?=

Here extraction from RFC 2045 is:

    (5)   (Soft Line Breaks) The Quoted-Printable encoding
          REQUIRES that encoded lines be no more than 76
          characters long.  If longer lines are to be encoded
          with the Quoted-Printable encoding, "soft" line breaks
          must be used.  An equal sign as the last character on a
          encoded line indicates such a non-significant ("soft")
          line break in the encoded text.

   Thus if the "raw" form of the line is a single unencoded line that
   says:

     Now's the time for all folk to come to the aid of their country.

   This can be represented, in the Quoted-Printable encoding, as:

     Now's the time =
     for all folk to come=
      to the aid of their country.

   This provides a mechanism with which long lines are encoded in such a
   way as to be restored by the user agent.  The 76 character limit does
   not count the trailing CRLF, but counts all other characters,
   including any equal signs.

Could anyone offer right way how to get round this?
Does actionmailer code need to be changed or need to write own 'quoted-printable' converter for redmine?

Actions #5

Updated by Kirill Ponomarev about 15 years ago

This patch does not resolve the problem for trunk r2924.
Can you update it?

Actions #6

Updated by Maxim Verevkin almost 15 years ago

When Base64.encode64 is applied the result is the string splitted with CRLF. The patch decorates each line with '=?utf-8?B?' prefix and '?=' suffix.

Actions #7

Updated by Stanislav German-Evtushenko almost 15 years ago

Maxim Verevkin wrote:

When Base64.encode64 is applied the result is the string splitted with CRLF. The patch decorates each line with '=?utf-8?B?' prefix and '?=' suffix.

Is it necessary to use both patches or just last one?

Actions #8

Updated by Maxim Verevkin almost 15 years ago

Only the new patch works well for redmine v0.9.1. It completely solved the issue of unreadable UTF-8 subjects in email notifications for us.

Actions #9

Updated by Stanislav German-Evtushenko almost 15 years ago

Maxim Verevkin wrote:

Only the new patch works well for redmine v0.9.1. It completely solved the issue of unreadable UTF-8 subjects in email notifications for us.

Does it for for quoted-printable subjects?

Actions #10

Updated by Stanislav German-Evtushenko almost 15 years ago

Stanislav German-Evtushenko wrote:

Maxim Verevkin wrote:

Only the new patch works well for redmine v0.9.1. It completely solved the issue of unreadable UTF-8 subjects in email notifications for us.

Does it for for quoted-printable subjects?

Oh, it seems like it should work :)

Actions #11

Updated by Stanislav German-Evtushenko almost 15 years ago

Maxim Verevkin wrote:

When Base64.encode64 is applied the result is the string splitted with CRLF. The patch decorates each line with '=?utf-8?B?' prefix and '?=' suffix.

Hm, documentation says that only '\n' adds after each 60 chars.

Encodes a string to its base 64 representation. Each 60 characters of output is separated by a newline character.

ActiveSupport::Base64.encode64("Original unencoded string")
# => "T3JpZ2luYWwgdW5lbmNvZGVkIHN0cmluZw==\n" 

http://api.rubyonrails.org/classes/ActiveSupport/Base64.html#M001381
Actions #12

Updated by Stanislav German-Evtushenko almost 15 years ago

Maxim,
I got how it works. Sorry for stupid questions.
I my point of view it's not good to use hardcoded charset. I think better way is using #{charset}.

Actions #13

Updated by Maxim Verevkin almost 15 years ago

Stanislav,

I my point of view it's not good to use hardcoded charset. I think better way is using #{charset}.

You are quite right here. Sorry, it was a quick patch to fix the annoying issue.

But I think that the right place to fix this issue is ActionMailer.

Actions #14

Updated by Sergey Smirnov almost 14 years ago

I have similar problem with redmine 1.1.0
Notification subjects looks"
=?utf-8?Q?=5B=D0=A2=D0=B5=D1=81=D1=82=D0=BE=D0=B2=D1=8B=D0=B9_=D0=B4=D0=BB=D1=8F_=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B8_e=2Dmail_=2D_=D0=9C=D0=B8=D0=B3=D1=80=D0=B0=D1=86=D0=B8=D1=8F_=23=38=35=5D_=28=D0=9D=D0=BE=D0=B2=D1=8B=D0=B9=29_=D0=9F=D1=...
It's strange that subject doesn't end with "?=" but with "..."
I applied your patches but it didn't help.
I guess that long subject is cutted by redmine with "..."
Do anybody know this problem.
I user russian locale with utf-8 charset.
Thanks.

Actions #15

Updated by Evgeniy Evteev over 13 years ago

patch not work in ver. 1.2.0
Help.

Actions #16

Updated by Soonhyoung An over 13 years ago

i have same problem.
(redmine 1.2.1)

all mail title over 70(?) bytes was crashed

Help..

Actions #17

Updated by Soonhyoung An over 13 years ago

sorry..
it was my mistake that report patch(mailer-long-subject-base64.patch )is not work with 1.2.1

it works very well..

(first patch only extends more char)
exact point of source code is before func create_mail
and as Stanislav German-Evtushenko commented

s.split.each { |part| @subject << "=?utf-8?B?#{part.strip}?=\r\n" }
should be change ->
s.split.each { |part| @subject << "=?#{charset}?B?#{part.strip}?=\r\n" }

Actions #18

Updated by MIchael Ermolenko about 13 years ago

These patches solved our problem (Redmine v1.2.1).

Is it planned to include these patches into official code?

Actions #19

Updated by Frédéric Géraud over 12 years ago

I've got the same problem. Trouble is, it collides with my Outlook redirection rules which are based on email subject causing horrific mayhem in my inbox :)

Being a Redmine user, not a Redmine administrator, I cannot decide whereas to apply this patch or not. Anyway, I'll try & ask.

It would really be great it it was to be included in your next official release.
Thanks a lot.

Actions #20

Updated by Toshi MARUYAMA about 10 years ago

  • Related to Defect #17752: mail subject come to unreadable code when it's too long added
Actions #21

Updated by Toshi MARUYAMA about 10 years ago

  • Tracker changed from Patch to Defect
  • Subject changed from Unreadable quoted-printable utf-8 subject in some mail clients to Unreadable quoted-printable utf-8 long subject in some mail clients
Actions #22

Updated by Toshi MARUYAMA about 10 years ago

  • Related to deleted (Defect #17752: mail subject come to unreadable code when it's too long)
Actions #23

Updated by Toshi MARUYAMA about 10 years ago

  • Has duplicate Defect #17752: mail subject come to unreadable code when it's too long added
Actions #24

Updated by lee min about 10 years ago

i have just upgrade my redmine server from 1.3.1 to 2.5.2 stable,but mail subject come to unreadable code when it's too long,according to the solvement above,I just do not know what to do since the mailing method has changed

Actions #26

Updated by lee min about 10 years ago

the subject turn into base64code is caused by gem mail,below is my testing result
info about mail

@ [root@redmine test]# gem list mail * LOCAL GEMS **
actionmailer (4.1.5, 3.2.18)
mail (2.6.1, 2.5.4)@
my ruby test script:sendm.rb

require 'mail'
options = { :address => "mail._domain_.com",
:port => 25,
:domain => 'mail._domain_.com',
:user_name => '_<username>_',
:password => '_<password>_',
:authentication => 'login',
:openssl_verify_mode => 'none',}
Mail.defaults do
delivery_method :smtp, options
end
Mail.deliver do
to ''
from ''
subject '测试标题长度大于80个字节时的表现测试标题长度大于80个字节时的表现测试标题长度大>于80个字节时的表现测试标题长度大于80个字节时的表现测试标题长度大于80个字节时的表现'
body 'testing sendmail'
end

and then run the command: ruby sendm.rb
the subject of the mail has truned
=?UTF-8?Q? =E6=B5=8B=E8=AF=95=E6=A0=87=E9=A2=98=E9=95=BF=E5=BA=A6=E5=A4=A7=E4=BA=8E80=E4=B8=AA=E5=AD=97=E8=8A=82=E6=97=B6=E7=9A=84=E8=A1=A8=E7=8E=B0=E6=B5=8B=E8=AF=95=E6=A0=87=E9=A2=98=E9=95=BF=E5=BA=A6=E5=A4=A7=E4=BA=8E80=E4=B8=AA=E5=AD=97=E8=8A=82=E6=...

Actions #27

Updated by Toshi MARUYAMA almost 8 years ago

  • Has duplicate Defect #24803: Incoming mailm subject are truncated added
Actions #28

Updated by Toshi MARUYAMA almost 8 years ago

  • Related to Defect #16859: rdm-mailhandler: subject corruption added
Actions #29

Updated by Toshi MARUYAMA almost 8 years ago

  • Has duplicate deleted (Defect #24803: Incoming mailm subject are truncated )
Actions

Also available in: Atom PDF