Discussion Board
MMS Body - Extracted but Unreadable
2004-10-12, 22:51
#1
Registered User
I have a problem reading the MMS body I have extracted using CPlainText. The platform is C++ on a Nokia 3650. Here is a snippet of my code:
CMsvEntrySelection* att = messageMmsMtm->GetAttachmentsL();
TFileName fileName;
TBuf<256> buf;
CPlainText* textAtt = CPlainText::NewL();
if(att->Count() > 0)
{
for(TInt i = 0; i < att->Count(); i++)
{
if(messageMmsMtm->AttachmentTypeL(att->At(i)) == MIMETxt)
{
messageMmsMtm->GetAttachmentPathL(att->At(i), fileName );
textAtt->ImportTextFileL( 0, fileName, CPlainText::EOrganiseByLine );
textAtt->Extract( buf, 0);
}
}
}
When I try to look at or work with the buf descriptor, all I get are box characters. The number of boxes equals (more or less) the size in bytes of the incoming MMS body, so I think I'm getting the right chunk.
I need to get a readable version of this body text into a TBuf descriptor in order to finish a 9 month project. I've tried converting it to/from/in/out of every conceivable format, but it's still useless.
Free pile of hurricane debris to the person providing the first workable answer!!
Registered User
OK, I figured it out. The body text of the incoming MMS is a two byte binary numeric representation with the least significant byte first.
So.... after my code listed above, I added:
TBuf8<256> bufTemp;
TBuf<256> bufOut;
_LIT8(KFormatTmp1,"%w");
for(TInt j = 0; j < buf.Length(); j++)
{
bufTemp.AppendFormat(KFormatTmp1, buf[j]);
}
bufOut.Copy(bufTemp);
bufOut now contains a workable version of the MMS body text.
What a stupid way to convert text. Anybody know a cleaner method?
I guess I get to keep my pile of debris...
Regular Contributor
i am not able to find variable "MIMETxt" which u have used, can u plz tell where it is located.
Thankx
Amit
Registered User
MIMETxt is a descriptor holding the standard MIME text string, as follows:
TBufC<15> MIMEJpg(_L("image/jpeg"));
TBufC<15> MIMEWav(_L("audio/wav"));
TBufC<15> MIMETxt(_L("text/plain"));
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules