[Bug 189139] New: decodeRFC2047String() doesn't parse stuff correctly

Jan Kundrát jkt at gentoo.org
Wed Apr 8 17:29:29 BST 2009


https://bugs.kde.org/show_bug.cgi?id=189139

           Summary: decodeRFC2047String() doesn't parse stuff correctly
           Product: kdepimlibs
           Version: unspecified
          Platform: Unlisted Binaries
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: NOR
         Component: kmime
        AssignedTo: tomalbers at kde.nl
        ReportedBy: jkt at gentoo.org
                CC: kdepim-bugs at kde.org


Created an attachment (id=32701)
 --> (http://bugs.kde.org/attachment.cgi?id=32701)
decodeRFC2047String.patch

I'm using a copy of trunk/KDE/kdepimlibs/kimap/rfccodecs.cpp in my private
project. I've done only minimal modifications for it to integrate into a
non-KDE environment.

The following code fails:

    QByteArray input = "From: =?UTF-8?B?UGF2ZWwgS29sw6HFmQ==?= <foo at bar>";
    qDebug() << input << KIMAP::decodeRFC2047String( input );
    input = "From: =?UTF-8?B?SmFuIEt1bmRyw6F0?= <jkt at gentoo.org>";
    qDebug() << input << KIMAP::decodeRFC2047String( input );
    input = "From: =?ISO-8859-1?Q?Jan_Kundr=E1t?= <kundratj at fzu.cz>";
    qDebug() << input << KIMAP::decodeRFC2047String( input );
    input = "Subject:
=?utf-8?b?YmzDqXNtcnQgxJvFocSNxZnFvsO9w6HDrcOpIOygoO2IrOyXkOyEnA==?=\n"
 "=?utf-8?b?IOyekOuwlOulvCDsgqzsmqntlZjripQg6rKD7JeQIOuMgO2VnA==?=\n"
 "=?utf-8?b?IOyCrOyaqeyekOyZgCDqsJzrsJzsnpDrpbwg7JyE7ZWc?=\n"
 "=?utf-8?b?IOyngOy5qOyEnA==?=";
    qDebug() << input << KIMAP::decodeRFC2047String( input );

What I got with version from KDE:

"From: =?UTF-8?B?UGF2ZWwgS29sw6HFmQ==?= <foo at bar>" "From:  <foo at bar>"
"From: =?UTF-8?B?SmFuIEt1bmRyw6F0?= <jkt at gentoo.org>" "From:  <jkt at gentoo.org>"
"From: =?ISO-8859-1?Q?Jan_Kundr=E1t?= <kundratj at fzu.cz>" "From: 
<kundratj at fzu.cz>"
"Subject: =?utf-8?b?YmzDqXNtcnQgxJvFocSNxZnFvsO9w6HDrcOpIOygoO2IrOyXkOyEnA==?=
=?utf-8?b?IOyekOuwlOulvCDsgqzsmqntlZjripQg6rKD7JeQIOuMgO2VnA==?=
=?utf-8?b?IOyCrOyaqeyekOyZgCDqsJzrsJzsnpDrpbwg7JyE7ZWc?=
=?utf-8?b?IOyngOy5qOyEnA==?=" "Subject:


"


What was the correct result (a lot of funny Unicode characters follows):

"From: =?UTF-8?B?UGF2ZWwgS29sw6HFmQ==?= <foo at bar>" "From: Pavel Kolář
<foo at bar>"
"From: =?UTF-8?B?SmFuIEt1bmRyw6F0?= <jkt at gentoo.org>" "From: Jan Kundrát
<jkt at gentoo.org>"
"From: =?ISO-8859-1?Q?Jan_Kundr=E1t?= <kundratj at fzu.cz>" "From: Jan Kundrát
<kundratj at fzu.cz>"
"Subject: =?utf-8?b?YmzDqXNtcnQgxJvFocSNxZnFvsO9w6HDrcOpIOygoO2IrOyXkOyEnA==?=
=?utf-8?b?IOyekOuwlOulvCDsgqzsmqntlZjripQg6rKD7JeQIOuMgO2VnA==?=
=?utf-8?b?IOyCrOyaqeyekOyZgCDqsJzrsJzsnpDrpbwg7JyE7ZWc?=
=?utf-8?b?IOyngOy5qOyEnA==?=" "Subject: blésmrt ěščřžýáíé 젠투에서
 자바를 사용하는 것에 대한
 사용자와 개발자를 위한
 지침서"

These data are taken from read-world mails (some of them were in fact generated
by KMail). The attached patch fixes the problem.

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the Kdepim-bugs mailing list