经典的ASP(VBScript)替换字符串中的特殊字符是很奇怪的 [英] Classic ASP (VBScript) replace special character in a string is acting strange
问题描述
在经典的ASP(VBScript)中,当我替换字符串时,会出现一个奇怪的字符。
In classic ASP (VBScript), when I replace the string, a strange character appears.
<%
myString = "My Ttitle ®"
myString = Replace(myString,"®", "®")
Response.Write(myString)
%>
如果我打印到HTML,最终结果是(其中有一个奇怪的A) :
If I print this out to HTML, the final result is (Which has a strange A in it):
My Ttitle ®
推荐答案
-
将此页添加到页面顶部
<%@ language =vbscript codepage =65001%>
在文本编辑器中打开文件从文件菜单中选择utf-8而不是ANSI编码
open your file in a text editor, (notepad will do) select Save As from the file menu and choose utf-8 rather than ANSI encoding
在头部添加< meta http- equiv = Content-Typecontent =text / html; charset = utf-8/>
(这实际上不是必需的,但不会造成任何损害)
add in your head section <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
(this isn't actually necessary but it doesn't do any harm)
此处的进一步资讯
http://www.hanselman.com/blog/InternationalizationAndClassicASP.aspx
这篇关于经典的ASP(VBScript)替换字符串中的特殊字符是很奇怪的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!