经典 ASP 写入 csv 文件,不将数据写入单独的列
我有一个创建 CSV 文件的经典 ASP 脚本,但它无法正确写入单独的列。它基本上将所有内容都写入第一列。
dim filesavepath
filesavepath = site_pathRoot & "dynamic/pdf/" & fileName & ".csv"
set FSO = Server.CreateObject("scripting.FileSystemObject")
set csvfile = FSO.CreateTextFile(filesavepath, true,true)
csvfile.writeLine(Head)
其中 head 是一个变量,
Head = "Date, Name, Recipe Name, Email, Joined Mailing List?, Site, Suggestion Content"
如果我使用
set csvfile = FSO.CreateTextFile(filesavepath, true)
它,它可以工作,但我需要使用
set csvfile = FSO.CreateTextFile(filesavepath, true,true)
一段时间,因为我需要在 CSV 中写入外来符号。当然必须有一种方法来保持这一点并保持列完好无损?
I have a classic ASP script creating a CSV file, but it isn't writing correctly to separate columns. It's basically writing it all to the first column.
dim filesavepath
filesavepath = site_pathRoot & "dynamic/pdf/" & fileName & ".csv"
set FSO = Server.CreateObject("scripting.FileSystemObject")
set csvfile = FSO.CreateTextFile(filesavepath, true,true)
csvfile.writeLine(Head)
Where head is a variable as such
Head = "Date, Name, Recipe Name, Email, Joined Mailing List?, Site, Suggestion Content"
If I use
set csvfile = FSO.CreateTextFile(filesavepath, true)
It works but I needed to use
set csvfile = FSO.CreateTextFile(filesavepath, true,true)
a while back because I need to write foreign symbols in the CSV. Surely there must be a way to keep this and keep the columns intact?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于数据行的开头和结尾有双引号,因此整行将被解释为一个字段。
As you have double quotes at the start and end of your data line the whole line is interpreted as one field.
做了一些挖掘,虽然这有点违反直觉,但如果您使用 TAB 字符分隔字段,那么 Excel 似乎可以很好地解析出 Unicode 文件。例如,这对我有用:
希望这有帮助。
Done a bit of digging, and although it's a bit counter-intuative, but if you delimit your fields with the TAB character, then Excel seems to parse out Unicode files quite nicely. e.g. this works for me:
Hope this helps.