asp-CreateObject("adodb.stream")资料写入utf-8格式

asp---CreateObject(adodb.stream)文件写入utf-8格式用CreateObject(Scripting.FileSystemObject)写入

asp---CreateObject("adodb.stream")文件写入utf-8格式

用CreateObject("Scripting.FileSystemObject")写入utf-8的文件会出现乱码问题

可以使用CreateObject("adodb.stream")写入,设置编码为utf-8即可

function writeToFile(charset,content,filepath)set stm=server.CreateObject("adodb.stream")stm.Type=2'以本模式读取stm.mode=3stm.charset=charsetstm.openstm.WriteText contentstm.SaveToFile server.MapPath(filepath),2 stm.flushstm.Closeset stm=nothingend function

charset:编码

content:写入内容

filepath:文件路径