[Bug 144779] New: kmail: MultiPart message plain/text body encoding patch

stanv stanv at altlinux.ru
Sat Apr 28 08:40:11 BST 2007


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=144779         
           Summary: kmail: MultiPart message plain/text body encoding patch
           Product: kmail
           Version: unspecified
          Platform: Compiled Sources
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
        AssignedTo: kdepim-bugs kde org
        ReportedBy: stanv altlinux ru


Version:           3.5.6 (using KDE KDE 3.5.6)
Installed from:    Compiled From Sources
Compiler:          gcc version 4.1.1 
OS:                Linux

Hello.

Steps to reproduce bug:
1. Compose new email in some specific language (charset encoding == koi8r, utf8(with russian words), cp1251,...).
2. Use richedit icons (e.g. increase text size)
3. Send message.

kmail will send this message in two parts:
First part: message in HTML.
Second part: same message but in in plain text.

Second part will be broken. Kmail write second part with bad encoded body.

Here are patch, for correct this:
===========================================================
diff -ruN kdepim-3.5.6/kmail/messagecomposer.cpp kdepim-3.5.6-modified/kmail/messagecompos
er.cpp
--- kdepim-3.5.6/kmail/messagecomposer.cpp  2006-10-01 21:30:30 +0400
+++ kdepim-3.5.6-modified/kmail/messagecomposer.cpp 2007-04-27 15:18:35 +0400
 @ -2056,6 +2056,7  @
     kdDebug(5006) << "Something is wrong and I can not get a codec." << endl;
     textbody = text.local8Bit();
   } else {
+    text=codec->toUnicode(text.latin1(), text.length());
     textbody = codec->fromUnicode( text );
   }
   if (textbody.isNull()) textbody = "";
===========================================================

This is because:
2049: QString text = hackConspiratorTextEdit->text();
return text already encoded as selected at MessageComposerWindow->Options->Set Encoding.

Example of bogus mail:
Erased head
From: xxxx <xxxxx>
To: xxxx xxxx xxx
Subject: HTML - koi8r
Date: Wed, 25 Apr 2007 11:50:04 +0400
User-Agent: KMail/1.9.6
MIME-Version: 1.0
Content-Type: multipart/alternative;
  boundary="Boundary-01=_sgwLGVR2Rq6T9jF"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
Message-Id: <200704251150.04977.xxxx xxxx xx>

--Boundary-01=_sgwLGVR2Rq6T9jF
Content-Type: text/plain;
  charset="koi8-r"
Content-Transfer-Encoding: 7bit

????
--Boundary-01=_sgwLGVR2Rq6T9jF
Content-Type: text/html;
  charset="koi8-r"
Content-Transfer-Encoding: 8bit

<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:10pt;font-family:Sans">
<p><span style="font-size:20pt;font-weight:600">ТЕСТ</span></p>
</body></html>
--Boundary-01=_sgwLGVR2Rq6T9jF--


Please notice 7bit and "????" (four question marks instead Russian "test" word).



More information about the Kdepim-bugs mailing list