日期:2014-05-17  浏览次数:20818 次

请问如何使用ASP将UTF-8编码的内容转换为GB2312编码的内容?
请问如何使用ASP将UTF-8编码的内容转换为GB2312编码的内容?网上搜索出来好多全不能用啊

最好给个能用的函数,谢谢啊!

------解决方案--------------------
<%
Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject( "adodb.stream ")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
%>
------解决方案--------------------
asp做这个工作应该有些吃力
------解决方案--------------------
在 <meta http-equiv= "Content-Type " content= "text/html; charset=utf-8 "> 中将charset=utf-8改写成charset=gb2312
------解决方案--------------------
function utf2gb(utfstr)
for dig=1 to len(utfstr)
if mid(utfstr,dig,1)= "% " then
if len(utfstr) > = dig+8 then
gbstr=gbstr & convchinese(mid(utfstr,dig,9))
dig=dig+8
else
gbstr=gbstr & mid(utfstr,dig,1)
end if
else
gbstr=gbstr & mid(utfstr,dig,1)
end if
next
utf2gb=gbstr
end function