最近搞了搞ASP 感觉这个别扭啊
fso无法读取utf-8的中文 会乱码地 所以用 ADODB.Stream对象吧...
感谢百度
Function get_html(File)
Dim objStream
' On Error Resume Next
Set objStream = Server.CreateObject("ADODB.Stream")
If Err.Number=-2147221005 Then
Response.Write "<div align=center>非常遗憾,您的主机不支持ADODB.Stream,不能使用本程序</div>"
Err.Clear
Response.End
End If
With objStream
.Type = 2
.Mode = 3
.Open
.LoadFromFile Server.MapPath(File)
If Err.Number<>0 Then
Response.Write "<div align=center>文件<font color=#ff0000>"&File&"</font>无法被打开,请检查是否存在!</font></div>"
Err.Clear
Response.End
End If
.Charset = "UTF-8"
.Position = 2
get_html= .ReadText
.Close
End With
Set objStream = Nothing
End Function
Public Function save_html(FileUrl)
set stm=server.CreateObject("adodb.stream")
stm.Type=2
stm.mode=3
stm.charset="utf-8"
stm.open
stm.WriteText content
stm.SaveToFile server.MapPath(FileUrl),2
stm.flush
stm.Close
set stm=nothing
End Function