summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper/imapwrapper.cpp
authorzautrix <zautrix>2004-11-06 23:30:02 (UTC)
committer zautrix <zautrix>2004-11-06 23:30:02 (UTC)
commit023e0e82dd8bf6421d12492a2dd25534fc43ad31 (patch) (side-by-side diff)
treecf0533e3ccc642cb57a41953f184f457fa5365ba /kmicromail/libmailwrapper/imapwrapper.cpp
parentf8841c92d5251f713eb7a025af8fdee52de45b3d (diff)
downloadkdepimpi-023e0e82dd8bf6421d12492a2dd25534fc43ad31.zip
kdepimpi-023e0e82dd8bf6421d12492a2dd25534fc43ad31.tar.gz
kdepimpi-023e0e82dd8bf6421d12492a2dd25534fc43ad31.tar.bz2
many ompi fixes
Diffstat (limited to 'kmicromail/libmailwrapper/imapwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp
index d90a8d2..eb2b47d 100644
--- a/kmicromail/libmailwrapper/imapwrapper.cpp
+++ b/kmicromail/libmailwrapper/imapwrapper.cpp
@@ -752,6 +752,25 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t
And we put it only into the mail if it is the FIRST part */
if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) {
QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding());
+
+ size_t index = 0;
+ char*res = 0;
+ int err = MAILIMF_NO_ERROR;
+
+ QString charset = currentPart->searchParamter( "charset");
+ qDebug("CHARSET %s ",charset.latin1() );
+ //if ( false ) {
+ if ( !charset.isEmpty() ) {
+ //err = mailmime_encoded_phrase_parse("iso-8859-1",
+ // text, strlen(text),&index, "iso-8859-1",&res);
+ err = mailmime_encoded_phrase_parse(charset.latin1(),
+ body_text.latin1(), body_text.length(),&index, "utf-8",&res);
+ if (err == MAILIMF_NO_ERROR && res && strlen(res)) {
+ //qDebug("res %d %s ", index, res);
+ body_text = QString::fromUtf8(res);
+ }
+ if (res) free(res);
+ }
//qDebug("encoding %d text %s ",currentPart->Encoding().latin1(), body_text.latin1() );
target_body->setDescription(currentPart);
target_body->setBodytext(body_text);