[Kde-pim] Re: KMime::Content::fromUnicodeString() considered harmful

David Jarvie djarvie at kde.org
Tue Jun 28 13:03:59 BST 2011


On Tue, June 21, 2011 2:03 pm, Thomas McGuire wrote:
> Hi,
>
> today I discovered that contrary to the documentation,
> KMime::Content::fromUnicodeString() does not set the content transfer
> encoding
> automatically, it needs to be done by the caller.
> I fixed the documentation now.
>
> I found the following places in KDEPIM that probably do it wrong and don't
> set
> the CTE and should be fixed:
> kdepim/examples/etm_usage/noteviewer.cpp
> kdepim/kalarm/kamail.cpp
> kdepim/messagecomposer/messagefactory.cpp
> 	MessageFactory::createForwardDigestMIME(), for non-English locales
> kdepim/mobile/notes/mainview.cpp
> kdepim/templateparser/templateparser.cpp
>
> There are likely other places outside of kdepim.git that are affected as
> well.
> Some callers do it correctly, btw.
>
> If the content transfer encoding is not set, an invalid mail will be
> created
> (KMail can deal with that gracefully, but probably not others).
> It is sufficient to set the CTE to base64, if you want the optimal CTE
> regarding space and readability use KMime::Util::encodingsForData() and
> take
> the first result that is not CE8Bit.
>
> If you want to know more about KMime, read http://api.kde.org/4.x-
> api/kdepimlibs-apidocs/kmime/html/index.html.

Can you confirm that the CTE only applies to the message body and
attachments, and not to headers? It isn't clear from the documentation,
but the structure of an actual transmitted email suggests that headers are
dealt with separately.

-- 
David Jarvie.
KDE developer.
KAlarm author - http://www.astrojar.org.uk/kalarm

_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list