[Bug 16733] Drop 'endings'?

https://www.w3.org/Bugs/Public/show_bug.cgi?id=16733

Eric Uhrhane <ericu@google.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ericu@google.com

--- Comment #4 from Eric Uhrhane <ericu@google.com> 2012-04-13 18:19:36 UTC ---
This is really only relevant for text files; no binary file is going to want
you to mess with its contents.  If you want to output a text file and have it
open correctly in Notepad, you'll need CRLF in there.  If you want it to work
well on Linux, you'll want just LF [although really a lot of Linux programs can
cope with CRLF as well].  Here's an example of a user having a problem on
Windows:
http://stackoverflow.com/questions/1278501/how-do-i-create-a-new-line-using-javascript-that-shows-correctly-in-notepad.

I don't see any need to apply this to Blob or ArrayBuffer data; it only really
makes sense on strings.  Do the conversion as you create the binary data, with
the invariant that it's already converted once it's in binary form.

I see that I wrote about the underlying filesystem in the spec; it's probably
more appropriate to talk about the host operating system; Linux systems can
certainly run on FAT32 filesystems, but they'll still expect LF rather than
CRLF.

Glenn:  Endings converts only output, not input, because this is FileWriter, an
output API.  If you wanted to convert input, that'd be in
FileReader.readAsText.  However, it's probably not necessary to add that.

I like your suggestion that this be a separate method, actually.  You could use
Simon's trick, but that's a bit of a pain, and adding a cleaner API would make
it more likely that developers would do it right.  If you wanted to handle
input as well, offer both convertToNativeLineEndings and
convertFromNativeLineEndings.  In the latter case, you'd probably want to
convert any CRLFs even if on a non-Windows platform, just in case.

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Friday, 13 April 2012 18:19:41 UTC