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

Thomas McGuire mcguire at kde.org
Tue Jun 21 14:03:37 BST 2011


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.

Regards,
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20110621/4cf79b63/attachment.sig>
-------------- next part --------------
_______________________________________________
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