Bug 62140 - Quoted text is wrongly decoded in multipart messages with different encodings
Summary: Quoted text is wrongly decoded in multipart messages with different encodings
Status: CLOSED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: SVN (3.5 branch)
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-04 23:50 UTC by Thiago Macieira
Modified: 2007-09-14 12:17 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
The e-mail message that shows problems (4.90 KB, text/plain)
2003-08-04 23:52 UTC, Thiago Macieira
Details
Snapshot showing no raw UTF-8 sequences in the text (8.46 KB, image/png)
2003-09-28 01:44 UTC, Marc Mutz
Details
Snapshot showing the composer window with undecoded chars (126.27 KB, image/png)
2003-09-28 02:44 UTC, Thiago Macieira
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thiago Macieira 2003-08-04 23:50:10 UTC
Version:           1.5.9 (using KDE 3.1.9)
Compiler:          gcc version 3.3.1 20030710 (prerelease)
OS:          Linux (i686) release 2.6.0-test1

I've received a multipart/mixed e-mail containing two text/plain sections, each encoded with a different charset. The reason behind that is that mailman adds a footer to messages passing through a mailing list, and when the encoding of that footer is different than the encoding of the message body, it splits the message into two MIME sections.

As far as I can tell, that's acceptable behaviour. And when displaying the message, KMail displays all non-ASCII characters correctly. There's even no distinction between the two sections.

However, when hitting Reply, the quoted text shows up with undecoded UTF-8.

If I set the encoding of the message to UTF-8, the body is displayed fine, but the footer isn't; the quoted text in the reply is properly decoded. If I set the encoding to ISO-8859-1, the footer is displayed ok, but neither the body nor the quoted text in the reply are correct.
Comment 1 Thiago Macieira 2003-08-04 23:52:00 UTC
Created attachment 2153 [details]
The e-mail message that shows problems

Here's the e-mail message that is showing the behaviour described above. As far
as I can tell, the message is properly encoded.
Comment 2 Marc Mutz 2003-09-28 01:44:01 UTC
Created attachment 2603 [details]
Snapshot showing no raw UTF-8 sequences in the text

As you can see, it works for me. My guess is that you have set the reader to
force iso-8859-* instead of auto-detecting. Else, try to upgrade to current
HEAD. I know that at one point	in the 3.2 dev cycle, this was broken - but
it's months ago.
Comment 3 Marc Mutz 2003-09-28 01:44:53 UTC
See comment and screenshot above. 
Comment 4 Thiago Macieira 2003-09-28 02:17:25 UTC
Will upgrade and report. 
Comment 5 Thiago Macieira 2003-09-28 02:37:51 UTC
Nope, sorry. Using HEAD dated of 10 minutes ago and it is still not working. 
 
I don't think you actually got the problem. I've got a message with two text/plain parts, one 
encoded in UTF-8 and the other encoded in ISO-8859-1. When reading the message, it's 
displayed fine. When replying, it is not. I'm attaching a screenshot demonstrating the issue. 
Comment 6 Thiago Macieira 2003-09-28 02:44:11 UTC
Created attachment 2605 [details]
Snapshot showing the composer window with undecoded chars

Here it goes. Note that you see two windows in this snapshot:

the background window is KMail with the open e-mail. You'll see from the MIME
tree that it has two "plain text" sections. Source code reveals one is UTF-8
and the other is ISO-8859-1 (as the e-mail in attachment #2153 [details]). There are no
raw UTF-8 sequences in there, as your screenshot shows as well.

however, the foreground window is a KMail composer window. As you'll see, it's
a reply of the e-mail in the background (I just hit R). The UTF-8 sequences are
there. This doesn't happen when the whole e-mail is UTF-8, but happens only for
those in which there are two text sections.
Comment 7 Marc Mutz 2003-09-28 14:51:16 UTC
Subject: kdepim/kmail

CVS commit by mutz: 

When replying, don't overwrite the per-bodypart codec unless an override-codec is set or no per-part codec was found. Fixes #62140
CCMAIL: 62140-done@bugs.kde.org


  M +2 -1      kmmessage.cpp   1.427


--- kdepim/kmail/kmmessage.cpp  #1.426:1.427
@@ -794,4 +794,5 @@ QCString KMMessage::asQuotedString( cons
     }
 
+    if ( mOverrideCodec || !codec )
     codec = this->codec();
 


Comment 8 Thiago Macieira 2003-09-28 17:29:41 UTC
Thanks, confirmed.