用FSO生产静态文件时只能生成unicode编码的,在asp下不能运行
|
|
如题,怎么办?
以下是全部代码
<%
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 |
|
|
|
|
|
|
|
|
|
|
微微百科
发表于 2012-2-15 08:58:28
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
fgmae
发表于 2012-3-7 16:36:49
|
显示全部楼层
此帖必火!

反对百度反对百度反对百度反对百度 |
|
|
|
|
|
|
|
|
|
|
squid2222
发表于 2012-3-8 15:51:56
|
显示全部楼层
|
|
|
|
|
|
|
|