Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / November 2006



Tip: Looking for answers? Try searching our database.

Problems using setting Fields charset in CDO, ADODB.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
João da Nóbrega - 22 Nov 2006 11:25 GMT
Hello:

According to this document:

http://msdn2.microsoft.com/en-gb/library/ms526970.aspx

we should be able to set the charset to be used in the CDO message fields.
The following code does not work though (sorry about being in c#, I was
redirected to this newsgroup):

---------------- CODE -------------------

           CDO.MessageClass message = new CDO.MessageClass();

           message.From = "\"€€€ euro\" <example@example.com>";
           message.To = "\"ホテラ japonese\" <example@example.com>";
           message.CC = "\"ascii\" <example@example.com>";
           message.Subject = "ホテラ";

           // This next line sets the character set for the message header
fields to utf-8.
           message.BodyPart.Charset = "UTF-8";

           // Print Message Stream
           
MessageBox.Show(message.GetStream().ReadText((int)ADODB.StreamReadEnum.adReadAll));

---------------- CODE -------------------

that produces the following output:

---------------- OUTPUT -------------------

thread-index: AccOJ48PNdWfi9koTGOIWkHWxIPvnw==
Thread-Topic: =?UTF-8?B?44Ob44OG44Op?=
From: =?UTF-8?B?4oKs4oKs4oKsIGV1cm8=?= <example@example.com>
To: "??? japonese" <example@example.com>
Cc: "ascii" <example@example.com>
Subject: =?UTF-8?B?44Ob44OG44Op?=
MIME-Version: 1.0
Content-Type: text/plain;
    charset="UTF-8"
Content-Transfer-Encoding: 7bit
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962

---------------- OUTPUT -------------------

As we can see in the output, the charset is used in the subject but is
ignored on some of the "addresses" fields. It seams there is some processing
by CDO to find out if it is required to use the charset encoding instead of
just always using the selected. Althouth the result is the same in the case
where only ascii characters are used, in the case where unicode japonese
characters are used it results in a problem.

Are we doing anything wrong? :|

Best Regards,
João Nóbrega.
João da Nóbrega - 23 Nov 2006 12:04 GMT
Wrong url :|. This is the correct one:

http://msdn2.microsoft.com/en-gb/library/ms526224.aspx

> Hello:
>
[quoted text clipped - 57 lines]
> Best Regards,
> João Nóbrega.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.