From: Jed on
I have a form that needs to handle international characters withing the UTF-8
character set. I have tried all the recommended strategies for getting utf-8
characters from form input to email message and I cannot get it to work. I
need to stay with classic asp for this.

Here are some things I tried:

'CDONTS
Call msg.SetLocaleIDs(65001)

'CDOSYS
msg.HTMLBodyPart.Charset = "utf-8"

I included the following meta tag in the email HTML:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

I also tried modifying the CharSet and CodePage of all involved Request and
Responses.

I was able to Response.Write the form content on post back to the screen and
it was properly rendered. However, none of my efforts can get the email to
render with the correct codebase. I have tried opening the email in Outlook
and Thunderbird. Neither one picks up on the UTF-8 charset meta tag.

Any help or link to tutorial would help so much.

Thanks.

From: Anthony Jones on

"Jed" <jedatu(a)newsgroups.nospam> wrote in message
news:B0D0F201-DA49-481D-9612-D8EE399C328B(a)microsoft.com...
> I have a form that needs to handle international characters withing the
UTF-8
> character set. I have tried all the recommended strategies for getting
utf-8
> characters from form input to email message and I cannot get it to work.
I
> need to stay with classic asp for this.
>
> Here are some things I tried:
>
> 'CDONTS
> Call msg.SetLocaleIDs(65001)
>
> 'CDOSYS
> msg.HTMLBodyPart.Charset = "utf-8"
>
> I included the following meta tag in the email HTML:
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
>
> I also tried modifying the CharSet and CodePage of all involved Request
and
> Responses.
>
> I was able to Response.Write the form content on post back to the screen
and
> it was properly rendered. However, none of my efforts can get the email
to
> render with the correct codebase. I have tried opening the email in
Outlook
> and Thunderbird. Neither one picks up on the UTF-8 charset meta tag.
>
> Any help or link to tutorial would help so much.
>

Mixing charsets in a message is a real mine field. Try this before writing
any content to the message:-

oMsg.BodyPart.charset = "UTF-8"

Where oMsg is a CDOSYS message object (CDONTS is deprecated don't write new
code against it).

That will make all text parts use UTF-8 encoding.

Anthony.



From: Jed on
Hey, Anthony,

Thanks for the suggestion. I was optimistic about its potential, but it
doesn't seem to make a difference.

Here is my code:
msg.BodyFormat = 0 'Set body text to HTML=0 TEXT=1
msg.MailFormat = 0 'Set format to MIME=0 TEXT=1
'Call msg.SetLocaleIDs(65001)
msg.Body = Message
msg.Send
'Try writing the contents to the browser to see if the string is bad
Response.Clear
'Response.CodePage = 65001
Response.CharSet = "utf-8"
Response.Write Message
Response.End

Basically if I post some a character like ú [u with an accent mark] it will
render fine in the browser, but the email it will appear as ú [A with tilde
over it, followed by a superscript o] I think that is the ANSII equivalent
or something.

I have read "The Absolute Minimum Every Software Developer Absolutely,
Positively Must Know About Unicode and Character Sets (No Excuses!)"
[http://www.joelonsoftware.com/articles/Unicode.html] but it doesn't seemed
to shed any light on why this isn't working.

Hmm..

"Anthony Jones" wrote:
> Mixing charsets in a message is a real mine field. Try this before writing
> any content to the message:-
>
> oMsg.BodyPart.charset = "UTF-8"
>
> Where oMsg is a CDOSYS message object (CDONTS is deprecated don't write new
> code against it).
>
> That will make all text parts use UTF-8 encoding.
>
> Anthony.
>
>
>
>
From: Jed on
Actually, this is the CDOSYS code I tried.

msg.BodyPart.Charset = "utf-8"
msg.HTMLBody = Message
msg.HTMLBodyPart.Charset = "utf-8"
msg.Send

I accidentally copied the CDONTS code in the last post.


"Jed" wrote:

> Hey, Anthony,
>
> Thanks for the suggestion. I was optimistic about its potential, but it
> doesn't seem to make a difference.
>
> Here is my code:
> msg.BodyFormat = 0 'Set body text to HTML=0 TEXT=1
> msg.MailFormat = 0 'Set format to MIME=0 TEXT=1
> 'Call msg.SetLocaleIDs(65001)
> msg.Body = Message
> msg.Send
> 'Try writing the contents to the browser to see if the string is bad
> Response.Clear
> 'Response.CodePage = 65001
> Response.CharSet = "utf-8"
> Response.Write Message
> Response.End
>
> Basically if I post some a character like ú [u with an accent mark] it will
> render fine in the browser, but the email it will appear as ú [A with tilde
> over it, followed by a superscript o] I think that is the ANSII equivalent
> or something.
>
> I have read "The Absolute Minimum Every Software Developer Absolutely,
> Positively Must Know About Unicode and Character Sets (No Excuses!)"
> [http://www.joelonsoftware.com/articles/Unicode.html] but it doesn't seemed
> to shed any light on why this isn't working.
>
> Hmm..
>
> "Anthony Jones" wrote:
> > Mixing charsets in a message is a real mine field. Try this before writing
> > any content to the message:-
> >
> > oMsg.BodyPart.charset = "UTF-8"
> >
> > Where oMsg is a CDOSYS message object (CDONTS is deprecated don't write new
> > code against it).
> >
> > That will make all text parts use UTF-8 encoding.
> >
> > Anthony.
> >
> >
> >
> >
From: Luke Zhang [MSFT] on
Hello,

Is the CDOSYS code executed in an ASP application? You may try send a plain
text email intstead of the HTML email like:

msg.BodyPart.Charset = "UTF-8"
msg.TextBody = Message
msg.TextBodyPart.Charset = "UTF-8"
msg.Send

Can you receive correct charactors in the email for plain text format?

Sincerely,

Luke Zhang

Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.