Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to make accented characters work with custom attachment?

3 views
Skip to first unread message

Amit

unread,
Dec 16, 2009, 6:48:37 AM12/16/09
to
Hi All,
I am creating a mail message with attachment which has custom
PR_ATTACH_MIME_TAG (e.g. xml/my_custom_subtype) and writing the
accented characters in it. When this message is received and read by
custom mail client, it sees the message as multipart mime message.
The problem is that when the custom mail client finds the accented
characters, it cannot recognize them and shows them in garbled way
( with ? ? ? etc). How can i send an attachment and force the custom
client to take it as unicoded way?
I have set the PR_INTERNET_CPID to CP_UTF8 for attachment and message
as well but no effect.

To create the attachment, I create the complete data as wide char
buffer and then convert it into ansi to write to stream
LPWSTR pszCustomMsg; // attachment data which will contain accented
chars
…..
…..
hr = pAttach->OpenProperty(PR_ATTACH_DATA_BIN, &IID_IStream, 0,
MAPI_CREATE | MAPI_MODIFY, (LPUNKNOWN*)pStream.getptr());
LPSTR pszTempString = UnicodeToAnsii(pszCustomMsg); // function to
convert to ansii
ULONG nBytesToWrite = (ULONG)strlen(pszTempString);
ULONG nWritten = 0;
LPBYTE pData = (LPBYTE)pszTempString;
while(nBytesToWrite > 0)
{
pStream->Write( pData, nBytesToWrite, &nWritten );
nBytesToWrite -= nWritten;
pData += nWritten;
}
pStream->Commit(STGC_DEFAULT);


Any help is highly appreciated.
Thanks,

Dmitry Streblechenko

unread,
Dec 16, 2009, 10:02:29 AM12/16/09
to
Firsly, it it really necessary to have MIME type with teh characters form
teh upper half of the ASCII table?
Secondly, would this not indicate that this is really a problem with the
receiving mail client? What is it?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Amit" <ver_a...@yahoo.com> wrote in message
news:6c1b52e6-ab9b-45b1...@v7g2000pro.googlegroups.com...

Amit

unread,
Dec 17, 2009, 3:12:45 AM12/17/09
to
Thanks Dmitry for reply. I am sorry that I couldn't understand your
first question/suggestion ? The email client is Zimbra which needs to
show these accented characters but cant show it properly. When mail
client sends the same message with same mime content for accented
characters, it shows them correctly. The difference is that I am
sending it as attachment and changing the PR_ATTACH_MIME_TAG to xml/
my_custom_type and mail client sends it as inline with charset=utf-8.
Does it matters?
Thanks.

On Dec 16, 8:02 pm, "Dmitry Streblechenko" <dmi...@dimastr.com> wrote:
> Firsly, it it really necessary to have MIME type with teh characters form
> teh upper half of the ASCII table?
> Secondly, would this not indicate that this is really a problem with the
> receiving mail client? What is it?
>
> --

> Dmitry Streblechenko (MVP)http://www.dimastr.com/


> OutlookSpy  - Outlook, CDO
> and MAPI Developer Tool

> -"Amit" <ver_amit...@yahoo.com> wrote in message

Dmitry Streblechenko

unread,
Dec 17, 2009, 12:35:36 PM12/17/09
to
Do you mean the actual attachment content with the characters fromr the
upper half of the ASCII table? Or the Content-Type MIME header?

--
Dmitry Streblechenko (MVP)


http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-

"Amit" <ver_a...@yahoo.com> wrote in message

news:3d2c1553-2a0d-4eeb...@y10g2000prg.googlegroups.com...

Amit

unread,
Dec 23, 2009, 5:23:06 AM12/23/09
to
I found the solution by setting the charset=utf-8. I used the
PR_ATTACH_MIME_TAG to set it and it worked well. It is certainly
related to email client which needed the charset to encode it
properly. Thanks a bunch Dimtry for your time and help.
0 new messages