This is good to know -- the data is likely to be used chiefly in Windows contexts, so the \r\n option might make most sense. Appreciate everyone's help on this!
joys
Ken
-----Original Message-----
From: Jonathan Rochkind [mailto:[log in to unmask]]
Sent: Wednesday, January 12, 2011 11:34 AM
To: Code for Libraries
Cc: Ken Irwin
Subject: Re: [CODE4LIB] data export help: line breaks on tab-delimited download
Windows NotePad probably needs an \r\n combo at the end of every line,
windows style. Whether you should worry about that depends on where the
file is destined for and if it matters. (Becuase an \r\n at the end of
every line might (or might not) mess up some unix or mac applications.
Ah, line endings.)
On 1/11/2011 7:57 PM, Ken Irwin wrote:
> Jonathan's questions were right on target. I was opening the files in the standard MS Notepad editor, and it was not observing line breaks. When I went to go open the files in MiniTab they were just fine. (Changing the files to .txt and text/plain did *not* fix the problem in Notepad, and I do wonder what it would take to make that program happy, but in this case it doesn't much matter.)
>
> Thanks for the help
> Ken
>
> -----Original Message-----
> From: Code for Libraries [mailto:[log in to unmask]] On Behalf Of Jonathan Rochkind
> Sent: Tuesday, January 11, 2011 3:41 PM
> To: [log in to unmask]
> Subject: Re: [CODE4LIB] data export help: line breaks on tab-delimited download
>
> 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?
>>
>> Thanks
>> Ken
>>
|