使用UTF-8编码打开文件
Function ReadFromUTF(TempString)
Set stm=server.CreateObject(ADO_STR)
stm.Type=2
stm.Mode=3
stm.Charset="utf-8"
stm.Open
stm.loadfromfile Server.MapPath(TempString)
str=stm.readtext
stm.Close
Set stm=Nothing
ReadFromUTF=str
End Function
使用UTF-8编码保存文件
Function WriteToUTF(content,Filen)
Set objStream=Server.CreateObject(ADO_STR)
With objStream
.Open
.Charset="utf-8" '编码,这里你可以改成任何编码
.Position=objStream.Size
.WriteText=content '模版+数据 写入内容
.SaveToFile server.mappath(Filen),2 '生成文件路径
.Close
End With
Set objStream=Nothing
End Function
防止注入bom头
Sub FSOSaveFile(Content,FileName)
dim stm:set stm=server.CreateObject("adodb.stream&#