最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
网站简繁体转换函数
时间:2008-01-12 编辑:简简单单 来源:一聚教程网
<%
'获取服务器生成的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)&"
"
-
上一个: 鱼和熊掌………………应用程序保护
-
下一个: 转: ASP 指南
相关文章
- VBS 批量Ping的项目讲解 09-19
- 如何封装一个Ajax函数介绍 09-16
- ASP实现加法验证码方法 09-16
- ASP错误捕获的几种常规处理方法介绍 09-16
- ajax实现城市三级联动的代码介绍 09-16
- asp中获取日期为星期几的技巧 09-14