function HasChinese(str)
HasChinese=false
dim i
for i=1 to Len(str)
if Asc(Mid(str,i,1))<0 then
HasChinese=true
exit for
end if
next
end function
当页面编码设置了
<% Response.CodePage=65001%>
<% Response.Charset="UTF-8" %>
时,Asc函数就失效了,所以上述判断方法此时应改为
function HasChinese(str)
Session.Codepage = 936 '先把编码改为963
HasChinese=false
dim i
for i=1 to Len(str)
if Asc(Mid(str,i,1))<0 then
HasChinese=true
exit for
end if
next
Session.Codepage = 65001 '再把编码改回65001
end function