首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

急需:一个asp导出csv文件直接下载。解决思路

2012-03-07 
急需:一个asp导出csv文件直接下载。%Response.BuffertrueResponse.AddHeaderContent-Disposition , at

急需:一个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()
%>

热点排行