View Single Post
  #3  
Old March 31st 08, 04:31 PM posted to microsoft.public.outlook.program_vba
MattS
external usenet poster
 
Posts: 2
Default MailItem.SaveAs encoding characters wrong from HTML message

Ken,

Thank you for your response.

I have asked my client to run chcp to determine the active code page on both
the problematic workstation and on one working properly. I will post the
result here when I have it.

I did some digging and could not find out how to determine the default
character set or font on an XP computer. Can you offer any tips?

Finally, if it helps, I've received some version info:

Problem computer:
XP Pro, version 2002, SP 2
Outlook 2003 (11.8206.8202) SP3

Good computer:
XP Pro, version 2002, SP 2
Outlook 2003 (11.8118.8132) SP2

Thank you again for your help.
Matt

"Ken Slovak - [MVP - Outlook]" wrote:

Is this with all HTML messages on that computer or only some messages?

What is the default character set and font on the problem computer? The code
page?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"MattS" wrote in message
...
Hello! It was suggested in the MSDN forums that I post my question here.
It's not VBA specific, though it pertains to Outlook interop with Visual
Basic. If there's a better place to post this, please let me know.


In a Visual Basic .NET 1.1 application which I wrote and have been
maintaining, I'm observing a strange behavior on one system (but not the
other systems I've installed it on). The application uses Outlook interop
to
communicate with Outlook 2003 and saves select email messages for further
processing. When saving messages, based on the MailItem's BodyFormat I
call
the MailItem's SaveAs method with the matching Outlook.OlSaveAsType
parameter. For instance, and with some code removed for clarity:

If curItem.BodyFormat = Outlook.OlBodyFormat.olFormatHTML Then
curItem.SaveAs(fn, Outlook.OlSaveAsType.olHTML)
ElseIf curItem.BodyFormat = Outlook.OlBodyFormat.olFormatPlain Then
curItem.SaveAs(fn, Outlook.OlSaveAsType.olTXT)
ElseIf curItem.BodyFormat = Outlook.OlBodyFormat.olFormatRichText Then
curItem.SaveAs(fn, Outlook.OlSaveAsType.olTXT)
ElseIf curItem.BodyFormat = Outlook.OlBodyFormat.olFormatUnspecified Then
curItem.SaveAs(fn, Outlook.OlSaveAsType.olTXT)
End If

I haven't had problems so far saving rich text messages as plain text, and
anything unspecified getting saved as plain text works fine for my
purposes.
The problem is that on this particular workstation when an HTML message is
saved there are character encoding problems in the resulting html file.

These encoding problems only affect certain punctuation such as em dash,
apostrophe, and tildes. The html file resulting from the MailItem.SaveAs
has, for example � instead of – . If I interactively go into Outlook
and
choose File Save As, selecting html, the characters in question are
saved
properly.

I am left feeling that because identical releases of the software on
different computers are behaving differently that it should be a problem
with
some system setting on the computer in question. The version of the OS
(XP
Pro) and Outlook (2003, SP3) are the same across these computers (though i
still need to get the specific version numbers looked up).

Does anyone have any thoughts on what would affect the formatting of the
SaveAs HTML output like this?



Ads