From 023e0e82dd8bf6421d12492a2dd25534fc43ad31 Mon Sep 17 00:00:00 2001 From: zautrix Date: Sat, 06 Nov 2004 23:30:02 +0000 Subject: many ompi fixes --- (limited to 'kmicromail/libmailwrapper/imapwrapper.cpp') 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); -- cgit v0.9.0.2