[Kde-pim] Character encoding handling in KMail/KMime

Ingo Klöcker kloecker at kde.org
Mon Nov 28 21:06:24 GMT 2011


On Monday 28 November 2011, Andras Mantia wrote:
> Hi,
> 
>  on the weekend I fixed a problem introduced with the HTML reply
> branch, where the characters in the reply were wrongly encoded.
> While trying to get around the code and see where do the strings get
> broken I realized that it is just insane what we do there with the
> character encodings. The messages are encoded, decoded often (and
> now I refer both to charset encoding and string encoding for
> transfer), while the message does not leave KMail (or its libraries,
> like composer, templateparser) code. This also includes of course a
> lot of QString->QByteArray and QByteArray->QString covnersion. In my
> opinion there should be exactly two conversion: when the message is
> read into KMime and when it is written out from KMime (either to
> disc, send through the network or someway else). For all the rest it
> should be just unicode in a QString.
>  Of course this is an intrusive change and KDE 5 (or whatever comes
> next material). What do you think of it? Does it even makes sense to
> go in this direction? Any better ideas?

This is difficult to answer because it depends on what the 
representation of the message is used for. Of course, it makes sense to 
reduce the conversions as much as possible, but I don't think that using 
a Unicode representation of the whole message makes sense. Do you mean 
the message text?

Actually, I think the message as a whole should never be serialized as 
Unicode string because it is never needed in this form. (Correct me if 
I'm wrong.) The message should either be in KMime or it should be 
serialized into a QByteArray (for storage on disk and sending). Apart 
from this only the body and the header content of individual message 
parts should be converted to Unicode for display, composing and other 
tasks where Unicode is really needed.


Regards,
Ingo
-------------- 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/20111128/a6c9fb69/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