[Zope] Generating text/csv from DTML method, Mime Type?

Farrell, Troy troy.farrell@wilcom.com
Fri, 10 Nov 2000 12:04:20 -0600


I know this sounds silly, but try making the url end with .csv
I wrote a perl cgi script some time ago that spit out a csv file.  When it
ended with .csv, IE seemed to ignore the server's Content-type: text/html
header.

http://finance.yahoo.com/q?s=WCG&d=v1
Look, my stock is falling!  Actually, if you look at the link below and to
the right of the table, you'll see a download spreadsheet link.  Yahoo uses
a &e=.csv to set the extension.  Presumably, the e value is for extension.

Troy

-----Original Message-----
From: zope@concision.com [mailto:zope@concision.com]
Sent: Friday, November 10, 2000 11:15 AM
To: zope@zope.org
Subject: Re: [Zope] Generating text/csv from DTML method, Mime Type?


"Brad Clements" <bkc@murkworks.com> writes:

> I'm create a CSV file that I would like browsers to get the "save as" 
> dialog when they select it.
> 
> I'm using RESPONSE.write() to write out the CSV file, and I set the 
> Content-Type before calling RESPONSE.write
> 
> 
> Netscape seems to work ok, it pops up a save box for "text/csv" and 
> "application/vnd.ms-excel".
> 
> However in both cases IE5.5 just ignores the data and re-requests the 
> page.
> 
> Does anyone know *all* the steps I need to take to get this to work 
> correctly with IE? I must be doing something wrong. I want to supply a 
> CSV file, but generated dynamically. I'm sure I'm missing a header 
> setting or something.

FWIW, I recently had to support a customer in downloading files for
use by spreadsheet software. After a little investigating, especially
at the IETF web/FTP site, I discovered that there is no registered
MIME type "text/csv". Can anyone refute this?

There is a registered MIME type "text/tab-separated-values". Based on
something I read recently on the Zope site, it may be that if you set
the MIME type to application/vnd.ms-excel but send a tab separated
values file, excel will open it. I haven't tried this though.

_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )