1.gb.asp
<%
'获取服务器生成的html代码
Function GetHTTPPage(url)
dim XmlHttp
set XmlHttp=Server.createobject("Microsoft.XMLHTTP")
XmlHttp.open "GET",url,false
XmlHttp.send()
'getHTTPPage=Http.responseText
if XmlHttp.readystate<>4 then exit function
GetHTTPPage=bytes2BSTR(XmlHttp.responseBody)
set XmlHttp=nothing
if err.number<>0 then err.Clear
End Function
Function Bytes2bStr(vin)
Dim BytesStream,StringReturn
Set BytesStream = Server.CreateObject("ADODB.Stream")
BytesStream.Type = 2
BytesStream.Open
BytesStream.WriteText vin
BytesStream.Position = 0
BytesStream.Charset = "GB2312"
BytesStream.Position = 2
StringReturn =BytesStream.ReadText
BytesStream.close
Set BytesStream = Nothing
Bytes2bStr = StringReturn
End Function
'转换函数中的页面分隔输出函数
sub splitwords(words)
into=words
out=""
'response.write "共有字数:"&len(into)&"
"
for i=1 to len(into) '循环遍历每个字符
'response.write "现在循环"&i&"/"&len(into)&"次,并开始检测字符"&mid(into,i,1)&"
"
if ascw(mid(into,i,1))<0 or ascw(mid(into,i,1))>255 then '如果是简体中文,进入检测阶段
code=instr(application("gb"),mid(into,i,1)) '获取此字符在简体字库中的位置
if code then'如果在简体字库中出现
out=out&mid(application("other_language"),code,1) '输出在繁体字库中相应的繁体字
'response.write "现在输出繁体第"&i&"个字符:"&mid(application("other_language"),i,1)&"
"
else
out=out&mid(into,i,1) '原样输出
'response.write "现在输出简体第"&i&"个字符"&mid(into,i,1)&"
"