开发者

Some Apostrophes showing as â?T in HTML Emails

开发者 https://www.devze.com 2023-03-19 05:21 出处:网络
I\'m using ASP Classic/VBScript to send emails using CDO.Message object. It appears that the single quote or apostrophe character ’ (as opposed to the standard character \') shows up in the recipient

I'm using ASP Classic/VBScript to send emails using CDO.Message object. It appears that the single quote or apostrophe character ’ (as opposed to the standard character ') shows up in the recipients email as: â?T

Where is the problem and what is the best way to resolve this? I actually tried running开发者_如何学编程 a replace to change all ’ to ' but it appears that didn't work.

I guess I'm really not even sure what the difference is between these two different characters, and why some sites, like Microsoft for example, use ’.


http://www.hanselman.com/blog/WhyTheAskObamaTweetWasGarbledOnScreenKnowYourUTF8UnicodeASCIIAndANSIDecodingMrPresident.aspx

all the info you could need on character encoding.


You need to set the correct character encoding on .BodyPart.Charset of your CDO.Message object.

Most likely you need to set it to "utf-8" as the default appears to be "us-ascii".


This indeed was a problem of character encoding. The solution was to put two lines of code in the web page that contains my form. I actually opted to add these lines of code to the top of my Global include file which I named inc_globals.asp. This file appears at the top of every page. Here's the code that fixed the problem:

Response.CodePage = 65001
Response.CharSet = "utf-8"

As a matter of documentation, here's a post that was helpful in solving this case: http://groups.google.com/group/microsoft.public.inetserver.asp.general/browse_thread/thread/b79e6b95e24ef0fe/a25c643aaf12770d


Mails are written in HTML format. Have you tried using HTML Entities? For your apostrophe, it should be '.

In VB :

Replace mailBody, "'", "'"
0

精彩评论

暂无评论...
验证码 换一张
取 消