raksmart活动促销

分享

写回答

发帖

用FSO生产静态文件时只能生成unicode编码的,在asp下不能运行

国外虚拟主机 国外虚拟主机 2270 人阅读 | 3 人回复

发表于 2012-2-14 21:46:15 | 显示全部楼层 |阅读模式

如题,怎么办?
以下是全部代码

<%
dim read,web_url,content,pageName
pageName = request("pageName")
if pageName = "" then response.End()
web_url="http://www.xxx.com/"&pageName&".asp"
read=getHTTPPage(web_url)
if read<>"" then
        content=read
        call makeindex()
end if

sub makeindex()
        Set Fso = Server.CreateObject("Scripting.FileSystemObject")
        Filen=Server.MapPath("/"&pageName&".html")
        Set Site_Config=FSO.CreateTextFile(Filen,,true)
        Site_Config.Write content
        Site_Config.Close
        Set Fso = Nothing
        Response.Write("<script>alert('Done---"&pageName&".html !');location.href='2008_to_html.asp'</script>")
        response.End()
end sub

Function getHTTPPage(url)
dim http
set http=Server.createobject("Microsoft.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
    exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
set http=nothing
if err.number<>0 then err.Clear
End function

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

%>

以上代码在中文系统上运行绝对正确,能生成html

回答|共 3 个

微微百科

发表于 2012-2-15 08:58:28 | 显示全部楼层

联系官方看看有没有解决方法
回复 支持 反对

使用道具 举报

fgmae

发表于 2012-3-7 16:36:49 | 显示全部楼层

此帖必火!












反对百度反对百度反对百度反对百度
RAKSmart
回复 支持 反对

使用道具 举报

squid2222

发表于 2012-3-8 15:51:56 | 显示全部楼层

在asp下不能运行
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则