A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

MailItem.SaveAs encoding characters wrong from HTML message



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old March 25th 08, 09:36 PM posted to microsoft.public.outlook.program_vba
MattS
external usenet poster
 
Posts: 2
Default MailItem.SaveAs encoding characters wrong from HTML 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?
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
OE6 inserts foreign characters into HTML Sig file. Why? Code shown Mike Outlook Express 14 August 23rd 07 08:22 PM
how to change encoding type while saving message Mrunali Outlook and VBA 0 April 18th 07 08:50 AM
MailItem.SaveAs method Mrunali Outlook - Using Forms 0 April 17th 07 03:16 PM
Force encoding when replying or forwarding message Fluke Outlook - General Queries 1 October 19th 06 09:15 PM
Default OE6 message encoding! D. W. K. Outlook Express 2 April 22nd 06 05:41 PM


All times are GMT +1. The time now is 05:06 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.