summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper/genericwrapper.cpp
Side-by-side diff
Diffstat (limited to 'kmicromail/libmailwrapper/genericwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/genericwrapper.cpp16
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
@@ -219,8 +219,22 @@ void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*m
delete rs;
}
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 {
bodyCache[b]=new encodedString(data,len);
@@ -343,9 +357,9 @@ 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( ">" );
}