Closed Bug 452649 Opened 16 years ago Closed 10 years ago

From header is not encoded correctly.

Categories

(Bugzilla :: Email Notifications, defect)

3.0.5
x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: docwhat, Unassigned)

Details

Attachments

(1 file)

It seems that Email::MIME is pretty broken wrt. mime-header encoding.

If you make a change to your newchangedmail.txt.tmpl to change the From line to include UTF-8 characters (either by using [%changername%] or by just hardcoding something) then when you receive the emails, it will have munged the non-ascii From characters.

Example: It turns my last name's o-umlaut from c3b6 to just f6.

What's going on is that while we can call $email->set_header() with a mime-header encoded string, we can't get it back out via $email->header().  $email->header() provides munged characters.

The workaround I have in the attached patch is to save the $encoded variable for $from, if possible; else use $email->header().

Ciao!
Attachment #335914 - Flags: review?(mkanat)
It seems that this patch is for 3.2 or trunk.
Really, it is a bug on 3.0.5?

And, i could not reporoduce this bug with
* utf8 = 1 (on)
* mail_delivery_method = sendmail
* mailfrom = "もじら組 Bugzilla-jp" <bugzilla-daemon@mozilla.gr.jp>
(In reply to comment #1)
> It seems that this patch is for 3.2 or trunk.
> Really, it is a bug on 3.0.5?

I did the patch against trunk because it said to on one of the documents I read before I contributed to Bugzilla.

It is an issue with 3.0.5 which is how I discovered it.

> And, i could not reporoduce this bug with
> * utf8 = 1 (on)
> * mail_delivery_method = sendmail
> * mailfrom = "もじら組 Bugzilla-jp" < bugzilla-daemon@mozilla.gr.jp>

What did the From line then look like?  I expected it to be 7-bit ascii mime-header encoding.  I forget exactly what it looks like, but it's something like ?UTF-8?blahblah

When I know that some JP linux distros used to have modified sendmails that would automatically fix encoding problems like this.  What did the From header look like before it was send to sendmail?  Specifically, if you set mail_deliver_method to not deliver (to the output file) then what does it look like there?

Ciao!
(In reply to comment #2)
> > It seems that this patch is for 3.2 or trunk.
> > Really, it is a bug on 3.0.5?
> 
> I did the patch against trunk because it said to on one of the documents I read
> before I contributed to Bugzilla.
> 
> It is an issue with 3.0.5 which is how I discovered it.

trunk is now 3.3. If you want to fix 3.0 branch only (b/c this bug is not in > 3.1), i think you should file a patch against the target branch itself.

> > And, i could not reporoduce this bug with
> > * utf8 = 1 (on)
> > * mail_delivery_method = sendmail
> > * mailfrom = "もじら組 Bugzilla-jp" < bugzilla-daemon@mozilla.gr.jp>
> 
> What did the From line then look like?  I expected it to be 7-bit ascii
> mime-header encoding.  I forget exactly what it looks like, but it's something
> like ?UTF-8?blahblah

With 3.1+, mail headers will be encoded with Q encoding in Bugzilla itself. Like
From: "=?UTF-8?Q?=E3=82=82=E3=81=98=E3=82=89=E7=B5=84=20Bugzilla=2Djp?=" <bugzilla-daemon@mozilla.gr.jp>

# I don't know about a "pure" 3.0 branch.
(In reply to comment #3)
> With 3.1+, mail headers will be encoded with Q encoding in Bugzilla itself.
> Like
> From: "=?UTF-8?Q?=E3=82=82=E3=81=98=E3=82=89=E7=B5=84=20Bugzilla=2Djp?="
> < bugzilla-daemon@mozilla.gr.jp>
> 
> # I don't know about a "pure" 3.0 branch.

Awesome.  That's great.  I can't wait till 3.2 comes out, then. :-)  I'm so happy that Bugzilla is moving quickly again.
Comment on attachment 335914 [details] [diff] [review]
Workaround Email::MIME From header bug

r- due to comment 2. (no needed for the trunk)
Attachment #335914 - Flags: review?(mkanat) → review-
WFM per comment 4 and comment 5 (problem already fixed in 3.2).
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: