Diffstat (limited to 'kmicromail/libmailwrapper/genericwrapper.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | kmicromail/libmailwrapper/genericwrapper.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp index d89a5f9..49227dd 100644 --- a/kmicromail/libmailwrapper/genericwrapper.cpp +++ b/kmicromail/libmailwrapper/genericwrapper.cpp @@ -220,6 +220,20 @@ void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*m } b = QString(res->Content()); delete res; + size_t index = 0; + char*resu = 0; + int err = MAILIMF_NO_ERROR; + QString charset = part->searchParamter( "charset"); + qDebug("CHARSET %s ",charset.latin1() ); + if ( !charset.isEmpty() ) { + err = mailmime_encoded_phrase_parse(charset.latin1(), + b.latin1(), b.length(),&index, "utf-8",&resu); + if (err == MAILIMF_NO_ERROR && resu && strlen(resu)) { + //qDebug("res %d %s ", index, resu); + b = QString::fromUtf8(resu); + } + if (resu) free(resu); + } target->setBodytext(b); target->setDescription(part); } else { @@ -344,7 +358,7 @@ QString Genericwrapper::parseMailbox( mailimf_mailbox *box ) if ( box->mb_display_name == NULL ) { result.append( box->mb_addr_spec ); } else { - result.append( convert_String(box->mb_display_name).latin1() ); + result.append( convert_String(box->mb_display_name) ); result.append( " <" ); result.append( box->mb_addr_spec ); result.append( ">" ); |