日期:2014-05-17  浏览次数:20968 次

急需:一个asp导出csv文件直接下载。
<%
Response.Buffer   =   true
Response.AddHeader     "Content-Disposition ", "attachment;     filename   =   member.csv "              
Response.CharSet     =     "UTF-8 "        
Response.ContentType     =     "application/octet-stream "  
Response.Write   "vvvvvvvvvvvvvvvvvvvvvvvv "
Response.End()
%>

我如上方法实现,可以得到csv文件,可是编码却是ANSI,请问如何生成UTF-8格式的文件   ??

谢谢   !!!

------解决方案--------------------
<%
Response.Buffer = true
response.ContentType= "application/octet-stream "
response.AddHeader "Content-Disposition ", "attachment; filename = member.csv "
set stream=server.CreateObject( "adodb.stream ")
stream.mode=3
stream.type=2
stream.open
stream.charset= "utf-8 "
stream.writetext "abc "
stream.position=0
stream.type=1
response.BinaryWrite(stream.read)
stream.close
response.End()
%>