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

Settings non-english characters in HTMLBody (using Redemption)



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 7th 08, 03:23 AM posted to microsoft.public.outlook.program_vba
MA[_2_]
external usenet poster
 
Posts: 47
Default Settings non-english characters in HTMLBody (using Redemption)

Hi,

I am using Redemption create Outlook messages.

I have noticed some messages not displaying proper characters in
Outlook. For example: I am creating some messages which has chinese
characters. See below the META tag of the HTML.

meta http-equiv="Content-Type" content="text/html; charset=big5"

In the C# debugger, I can see "htmlBody" contains correct the
characters but the message showing garbase.

message.HTMLBody = htmlBody; // htmlBody ok


Also the OutlookSpy CurrectItem.HTMLBody shows correct format. Do I
need to set some other properties in Outlook?

Thanks for the advice.

Regards,
MA
Ads
  #2  
Old February 7th 08, 05:30 AM posted to microsoft.public.outlook.program_vba
MA[_2_]
external usenet poster
 
Posts: 47
Default Settings non-english characters in HTMLBody (using Redemption)

I have noticed, settings the InternetCodepage shows the correct
characters.

--------------------------------------------------
message.HTMLBody = htmlBody;
message.InternetCodepage = 52936;
--------------------------------------------------

Is this the best way to solve the issue?

Regards,
MA
  #3  
Old February 7th 08, 07:12 AM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Settings non-english characters in HTMLBody (using Redemption)

Have you tried to HTML-encode the Chinese characters first?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"MA" wrote in message
...
Hi,

I am using Redemption create Outlook messages.

I have noticed some messages not displaying proper characters in
Outlook. For example: I am creating some messages which has chinese
characters. See below the META tag of the HTML.

meta http-equiv="Content-Type" content="text/html; charset=big5"

In the C# debugger, I can see "htmlBody" contains correct the
characters but the message showing garbase.

message.HTMLBody = htmlBody; // htmlBody ok


Also the OutlookSpy CurrectItem.HTMLBody shows correct format. Do I
need to set some other properties in Outlook?

Thanks for the advice.

Regards,
MA



  #4  
Old February 7th 08, 10:02 AM posted to microsoft.public.outlook.program_vba
MA[_2_]
external usenet poster
 
Posts: 47
Default Settings non-english characters in HTMLBody (using Redemption)

Yes, I have a helper method which read from the file. The method takes
the file path and encoding.

helper.LoadFromFile(filePath, Encoding.GetEncoding("big5"));

Hope I haven't mis-understood your question. Does my question above
make sense? Do I have to set the "InternetCodepage" property?

Regards,
MA



  #5  
Old February 8th 08, 05:37 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Settings non-english characters in HTMLBody (using Redemption)

No, I meant encoding the actual Chinise characters as &#XYZ;
E,g. Ђ

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"MA" wrote in message
...
Yes, I have a helper method which read from the file. The method takes
the file path and encoding.

helper.LoadFromFile(filePath, Encoding.GetEncoding("big5"));

Hope I haven't mis-understood your question. Does my question above
make sense? Do I have to set the "InternetCodepage" property?

Regards,
MA





  #6  
Old February 9th 08, 12:02 AM posted to microsoft.public.outlook.program_vba
MA[_2_]
external usenet poster
 
Posts: 47
Default Settings non-english characters in HTMLBody (using Redemption)

Thanks "Dmitry" for your response.

I will try to explain below the source of the message my steps:

1) The Outlook message HTMLBody comes from a external HTML file.
Example of the HTML source:
---------------------------------------------
html
head
title¨C ¤é ¶× ¥« ² ³ø/title
meta http-equiv="Content-Type" content="text/html; charset=big5"
/head
body bgcolor="#FFFFFF" link="#003A9A" vlink="#003A9A" alink="#003A9A"
leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"
table width="100%" border="0" cellspacing="0" cellpadding="0"
.......
---------------------------------------------

2) My program read the "charset" value from the HTML (use the default
encoding in first pass), then use the charset value (i.e. "big5") to
decodes to string.
bytes = LoadFromFile(path);
htmlBody = Encoding.GetEncoding("big5").GetString(bytes);

3) Set the Outlook message HTMLBody.
message.HTMLBody = htmlBody

As I said earlier, I can see garbage characters in Outlook message.
Outlook message, view source shows the "charset=big5". If I use the
OutlookSpy-CurrentItem, the HTMLBody inside the OutlookSpy shows
correct format. Why the same message in Outlook client shows garbage
and OutlookSpy shows correct?

Also said earlier, if I set the "InternetCodepage" then the message
shows correctly in Outlook. Any pros and cons about this approach?

Thanks in advance for your suggestions.

Regards,
MA
  #7  
Old February 9th 08, 05:13 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Settings non-english characters in HTMLBody (using Redemption)

That should be Ok, but ideally HTML encoding all characters would be much
better.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"MA" wrote in message
...
Thanks "Dmitry" for your response.

I will try to explain below the source of the message my steps:

1) The Outlook message HTMLBody comes from a external HTML file.
Example of the HTML source:
---------------------------------------------
html
head
title¨C ¤é ¶× ¥« ² ³ø/title
meta http-equiv="Content-Type" content="text/html; charset=big5"
/head
body bgcolor="#FFFFFF" link="#003A9A" vlink="#003A9A" alink="#003A9A"
leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"
table width="100%" border="0" cellspacing="0" cellpadding="0"
........
---------------------------------------------

2) My program read the "charset" value from the HTML (use the default
encoding in first pass), then use the charset value (i.e. "big5") to
decodes to string.
bytes = LoadFromFile(path);
htmlBody = Encoding.GetEncoding("big5").GetString(bytes);

3) Set the Outlook message HTMLBody.
message.HTMLBody = htmlBody

As I said earlier, I can see garbage characters in Outlook message.
Outlook message, view source shows the "charset=big5". If I use the
OutlookSpy-CurrentItem, the HTMLBody inside the OutlookSpy shows
correct format. Why the same message in Outlook client shows garbage
and OutlookSpy shows correct?

Also said earlier, if I set the "InternetCodepage" then the message
shows correctly in Outlook. Any pros and cons about this approach?

Thanks in advance for your suggestions.

Regards,
MA


 




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
Chinese characters in English subject George Coulas Outlook - General Queries 0 December 5th 07 05:07 PM
HTMLBody with images tim johnson Outlook and VBA 5 February 1st 07 12:30 AM
How to set a long HTMLBody mml Outlook and VBA 1 October 28th 06 06:39 PM
HTMLBody Houston Lucifer Outlook and VBA 5 July 17th 06 12:16 PM
Spaces Removed in HTMLBody [email protected] Outlook and VBA 3 June 6th 06 08:02 PM


All times are GMT +1. The time now is 03: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.