line breaks don't appear when you view it with what software?
Can you have your browser save it to disk after it prompts you to do so,
and open with a reliable text editor you know how to use and confirm if
\n is really still in the file or not?
If you are viewing it in your web brower, then your web browser is
probably deciding to display it as HTML. The line breaks are probably
still there, the web browser is just displaying as HTML. Web browsers
aren't great places to view text. If you are viewing it after saving it
to disk, then your web browser probably won't know to display as text
unless the filename ends in ".txt". If you are viewing it without
saving to disk (but then why are you using
Content-Disposition:attachment?), then make sure you're still setting
the content-type appropriately; and you may need to make the filename
end in .txt anyway.
The line breaks are probably still there, your web browser is just
rendering the file as html rather than txt, is my guess.
On 1/11/2011 3:29 PM, Ken Irwin wrote:
> Hi all,
> I've got a dataset that I'm trying to make exportable for MiniTab, etc. It's tab-delimited and lines end with "\n".
> When I serve it up as "text/plain" and view it in my web browser, it works just fine and all the line breaks are in the right places.
> When I send the header to make it a downloadable "attachment":
> Content-Disposition: attachment; filename="categories.tab"
> Then there are no line breaks at all - it's all one line, and the line-breaks don't appear.
> I tried "\r" instead, and that didn't work either.
> Any idea what I might be doing wrong here?