Last Comment Bug 669925 - Wrong "From" shown in message list when email address contains Unicode
: Wrong "From" shown in message list when email address contains Unicode
Status: RESOLVED FIXED
:
Product: Thunderbird
Classification: Client Software
Component: Folder and Message Lists (show other bugs)
: 5.0
: All Other
: -- normal with 5 votes (vote)
: Thunderbird 12.0
Assigned To: Mark Banner (:standard8)
:
Mentors:
: 682257 716021 716220 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-07-07 09:28 PDT by Alexander Buchner
Modified: 2012-01-11 12:53 PST (History)
14 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
+
fixed
fixed


Attachments
WrongFrom.jpg (381.75 KB, image/jpeg)
2011-07-07 09:28 PDT, Alexander Buchner
no flags Details
This is the actual mail. (1.77 KB, text/plain)
2011-07-07 09:31 PDT, Alexander Buchner
no flags Details
The fix (2.56 KB, patch)
2012-01-10 13:09 PST, Mark Banner (:standard8)
mozilla: review+
standard8: approval‑comm‑aurora+
Details | Diff | Splinter Review

Description Alexander Buchner 2011-07-07 09:28:25 PDT
Created attachment 544516 [details]
WrongFrom.jpg

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0
Build ID: 20110615151330

Steps to reproduce:

I opened my spam folder. I saw a mail, which has a name in the "From"-column, that I know (I also have an address book entry to this name, but without an eMail address). This name was not shown in the from-field of the preview.
The name also doesn't occur in the message source.


Actual results:

There is a name shown in the "From"-column, which is not part of the source.


Expected results:

"From" of message list and message preview should be the same.
No values should appear that aren't part of the source.

As this a spam mail, some users give more credibility, if they "know" the sender...
Comment 1 Alexander Buchner 2011-07-07 09:31:04 PDT
Created attachment 544518 [details]
This is the actual mail.
Comment 2 Ludovic Hirlimann [:Usul] 2011-07-08 08:29:20 PDT
Does rebuilding the index for the folder that contains the email helps ?
Comment 3 Alexander Buchner 2011-07-08 08:32:02 PDT
No, it doesn't.
Comment 4 Jim Porter (:squib) 2011-07-08 08:53:17 PDT
I'm guessing this has to do with the fact that the email address is non-ASCII and the display name lookup from bug 243631 is barfing on that, but I'm not totally sure.
Comment 5 Mogens Krage 2011-07-14 00:00:45 PDT
(In reply to comment #4)
> I'm guessing this has to do with the fact that the email address is
> non-ASCII and the display name lookup from bug 243631 is barfing on that,
> but I'm not totally sure.

I have the same problem in some newsgroups and in all cases the email adresses in the From column contains non-ASCII characters.
Comment 6 Alexander Buchner 2011-07-17 02:50:00 PDT
I just noticed three things:

1. You can simply find this kind of mail by sorting by "From", because the mails get really sorted by the alias in the Source (in my example "Dr. Friedelinde.Friederike", so it will appear at "D") but as stated before in the overview you see the entry of your address book. So these eMails seem to be sorted in the wrong way.

2. Today the exact mail I mentioned before, has a different "From", also from my address book.

3. Both entries of the address book are entries without an email address. Perhaps this helps, perhaps it's just coincidence.
Comment 7 Leif Neland 2011-07-28 03:54:32 PDT
Bug confirmed when an user with domain @Fjørndættehotmail.com (a mangled version of adress obfucation was seen by several thunderbird5-users with a "faked" name taken from their adressbook.
When the sender removed the non-ascii characters, to @Fjrndttehotmail.com, the sender name appeared correctly.

See for instance Message-ID: <4e30703b$0$311$14726298@news.sunsite.dk> from dk.edb.internet.software.mail+news where thunderbird5 does not show my name as sender.
Comment 8 mploug 2011-08-14 08:38:12 PDT
If you uncheck "Show only display name for people in my address book" the right sender name is shown. 

You find it here:
Tools > Options > Advanced > click the Read and display tab.

But still this must be a bug.
Comment 9 Jim Porter (:squib) 2011-09-03 17:42:57 PDT
*** Bug 682257 has been marked as a duplicate of this bug. ***
Comment 10 Jim Porter (:squib) 2011-09-10 23:20:50 PDT
Confirming this, since I see it too. It appears to pick up the first contact in the address book that matches the substring before the first Unicode character, e.g. Bärb@example.com would use the display name from Bob@nowhere.com in the address book.
Comment 11 Jim Porter (:squib) 2011-09-12 17:50:06 PDT
WADA, this bug and bug 672966 aren't actually dependent on one another (though they're both the result of the same change). This is an actual bug, in that we don't handle Unicode properly when looking for a contact in the address book. Bug 672966 is just an issue with user confusion, which can hopefully be helped with some documentation.
Comment 12 Florian J. [:FeuerFliege] 2012-01-08 02:59:22 PST
*** Bug 716220 has been marked as a duplicate of this bug. ***
Comment 13 Florian J. [:FeuerFliege] 2012-01-08 03:06:54 PST
(In reply to Jim Porter (:squib) from comment #10)
> It appears to pick up the first contact
> in the address book that matches the substring before the first Unicode
> character

I cannot see this connection here. It is always the same contact from the address book. But in my case the from header contains no email address, but only a name with a non-ASCII character.

I made some tests:
»From: Big Bad Spammer« → TB shows “Big Bad Spammer”
»From: Big Bäd Spammer« → TB shows contact form the address book
»From: Big Bäd Spammer a@b.invalid« → TB shows contact from the address book
»From: Big Bäd Spammer <a@b.invalid>« → TB shows “Big B�d Spammer”
Comment 14 Jim Porter (:squib) 2012-01-09 17:21:16 PST
*** Bug 716021 has been marked as a duplicate of this bug. ***
Comment 15 Mark Banner (:standard8) 2012-01-10 13:09:40 PST
Created attachment 587443 [details] [diff] [review]
The fix

This is a two part fix:

1) In nsAbMDBDirectory we now check to see if the email address has been truncated after conversion of utf-8 to utf-16, if so, there's probably been an error, so return the fact (we already check the email address isn't empty at the start of the function).

2) In the DB view, use the decoded form of the from field message header rather than the encoded form. This means we get a proper utf-8 value passed to GetCardForEmailAddress and we display the right thing in the thread list.
Comment 16 David :Bienvenu 2012-01-11 09:03:53 PST
Comment on attachment 587443 [details] [diff] [review]
The fix

this looks good - I'll try to test it later.
Comment 17 Mark Banner (:standard8) 2012-01-11 10:50:34 PST
Comment on attachment 587443 [details] [diff] [review]
The fix

Checked into trunk:

http://hg.mozilla.org/comm-central/rev/4a3f5d039f95
Comment 19 Jim Porter (:squib) 2012-01-11 12:53:20 PST
*** Bug 717316 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.