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
  #1  
Old March 25th 08, 10: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?
Ads
  #2  
Old March 26th 08, 02:49 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default MailItem.SaveAs encoding characters wrong from HTML message

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?


  #3  
Old March 31st 08, 05: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?



  #4  
Old April 1st 08, 03:26 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default MailItem.SaveAs encoding characters wrong from HTML message

I'm not sure about the default code page but the fonts are set for the
desktop and used throughout Windows. Right-click on the desktop, select
Properties, Appearance tab, Advanced button. Each desktop element has an
associated font if it's an element that supports text.

For the code page there's always google search.

You can also go to www.slipstick.com and search for Outlook 2002 versions
and see if any fixes are listed that are relevant between the versions you
listed.

--
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
...
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


 




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 09:22 PM
how to change encoding type while saving message Mrunali Outlook and VBA 0 April 18th 07 09:50 AM
MailItem.SaveAs method Mrunali Outlook - Using Forms 0 April 17th 07 04:16 PM
Force encoding when replying or forwarding message Fluke Outlook - General Queries 1 October 19th 06 10:15 PM
Default OE6 message encoding! D. W. K. Outlook Express 2 April 22nd 06 06:41 PM


All times are GMT +1. The time now is 08:38 PM.


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.