Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 25th, 2008, 11:16 PM
Registered User
 
Join Date: Nov 2008
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default CDO.Message utf-8 Problem

Hi All,

I have vbscript (ASP) code that sends emails using information passed into the script from a Flash component. The information is escaped using Flash's escape function so I receive the values properly and then decode them.

I can display the decoded information correctly in a web browser using UTF-8 encoding on the web page, however when I send the information via email the unicode values in the message body show the "funny" characters instead of what I expect. For example, when I look at the email sent by the script I see these three characters — instead of the em dash.

I've tried setting the charset for the email but it doesn't seem to have any effect.

Here's the my code:
Code:
      Set objMail = Server.CreateObject("CDO.Message")
      Set objBodyPart = objmail.BodyPart
      objBodyPart.Charset = "UTF-8" 

          Set objConf = Server.CreateObject("CDO.Configuration") 
          Set objFields = objConf.Fields

          With objFields
           .Item("schemas-forum won't allow urls") = 2
           .Item("schemas-forum won't allow urls") = "smtphost" 
           .Item("schemas-forum won't allow urls") = 20
           .Item("schemas-forum won't allow urls") = 25
           .Update 
          End With

          With objMail
              Set .Configuration = objConf
            .From = email
              .To = Trim(recip)
              .Subject = subject

          .TextBody = txtboilerplate   'the txtboilerplate contains the unicode chars
          End With

          objMail.Send
          Set objFields = Nothing
          Set objConf = Nothing
          Set objMail = Nothing
Is there something wrong with how I'm trying to set the charset?

Thanks!

Reply With Quote
  #2 (permalink)  
Old June 27th, 2009, 10:52 AM
Registered User
 
Join Date: Jun 2009
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
Default unicode problem

Hi,

I am having similar problems, regarding sending email using cdo, with the Euro symbol incorrectly displayed.

Having Google'd this problem, it appears that asp 3.0 is a technology that is outdated, since the consensus seems to be that .net solves the problem since it is unicode compatible.

I am new to this forum and in fact new to the whole posting scenario, but since no one has replied to your post I assume that, the above correct.

Can anyone confirm or deny this assertion?
Reply With Quote
  #3 (permalink)  
Old June 28th, 2009, 11:02 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

ASP is old and out of date, yes. But CDO isn't all that old and it *should* handle Unicode correctly.

But it may be that it just doesn't handle Unicode properly in a *TEXT* body. Have you tried using an HTMLBody, instead??

You make me want to go experiment with this. You say the Euro symbol doesn't come out right??

By the by: ASP *is* Unicode compatible and has been since it was first launched back in the late 1990s. Both VBScript and JScript--the two languages used with ASP--use *ONLY* Unicode internally! *ALL* characters in either language are always 16 bits (2 bytes) long. It's only when you output text or HTML from ASP code that a conversion from Unicode to the code page currently in effect takes place. There is one funny-odd (and stupid, really) limitation: The source code files used for ASP coding can *not* be Unicode. Go figure.
Reply With Quote
Reply


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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Source: CDO.Message.1 please help me:) ilknur SQL Server 2000 1 July 23rd, 2006 12:52 PM
Need help related CDO.Message shankhan Classic ASP Basics 9 January 2nd, 2005 07:08 PM



All times are GMT -4. The time now is 08:01 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.