[Kde-pim] Using kmime lib to create UTF-8 email message

David Jarvie djarvie at kde.org
Wed Jan 20 00:03:44 GMT 2010


Hi Ingo,

On Tuesday 19 Jan 2010 23:24:23 Ingo Klöcker wrote:
> On Tuesday 19 January 2010, David Jarvie wrote:
> > I attach the whole email text which was returned by encodedContent().
> > The two ways of producing it (setBody() and fromUnicodeString()) both
> > produce the same result. The original body text was some Cyrillic
> > text conveniently provided by a spam email which I was sent):
> >
> > Під час клацання
> 
> The problem is that this Cyrillic text was converted twice from Unicode 
> to utf-8, i.e. the result of the first conversion was again interpreted 
> as Unicode and then recoded to utf-8.

I'm not sure how that would have been done, since converting to UTF-8 changes it to a QByteArray, not a QString. Would a double conversion be produced by this? (Note that I'm not aware of this actually having happened):

   bodyText = QString(originalBodyText.toUtf8())

> Are you sure that bodyText contains the correct Unicode string? How did 
> you set bodyText? If bodyText does already contain a utf-8 encoded 
> version of the text instead of the Unicode version then this would 
> explain your observations.

I've printed out the bodyText QString using kDebug(), and it shows the correct Cyrillic text on konsole (which has UTF-8 set as the default character encoding). Is this sufficient evidence that it contains the correct Unicode string, or could that be misleading?

Cheers,
-- 
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