Possible bug with non-ascii sender labels


I think I am facing a bug, hope someone (@cketti ?) could point me in the right direction to make a quick patch.

If I receive an E-Mail such as " تست noreply@example.com" the sender is displayed as “<Unknown Sender>”. In fact for any E-Mail with non-ascii label (I mean the text before <>), it is displayed as such.

The above email are sent by mailutils in this manner:

mail me@example.com -s "my subject" -a "From: تست <noreplay@example.com>" -a "Content-Type: text/plain; charset: UTF-8" ...

At first I thought it is a problem with Arabic letters, however, the result is the same with other non-ascii letters:

mail me@example.com -s "my subject" -a "From: 蛸 <noreplay@example.com>" -a "Content-Type: text/plain; charset: UTF-8" ...

When I inspect the headers inside K-9, I can see the correct “From” label and address.

Surprisingly, if I send the same thing with Thunderbird it ends up being displayed correctly. I could not find a meaningful difference between E-Mail composed by Thunderbird vs. sendutils.

I tried debugging “MessageListExtractor.kt” in the latest git version and noticed that “cursor.getString” function returns no result for non-ascii mails sent with mailutils.

Would you mind please help me to analyse the problem further and possibly fix it?

Thanks and Merry Christmas

K-9 Mail doesn’t yet support RFC 6532 - Internationalized Email Headers.

You’ll have to encode the display name (see RFC 2047).
The header field in your example would look like this:

From: =?UTF-8?B?2KrYs9iq?= <noreply@example.com>

Thanks for the excellent answer!