W3C home > Mailing lists > Public > public-device-apis@w3.org > February 2010

File API - readAsText() - newline translation

From: Michael A. Puls II <shadow2531@gmail.com>
Date: Sat, 06 Feb 2010 07:31:51 -0500
To: public-device-apis@w3.org
Message-ID: <op.u7pg3cmo1ejg13@sandra-svwliu01>
In Firefox, I noticed that when using readAsText(), the FileReader result  
shows the file's text as-is. I think it'd be cool if you could make  
readAsText return the file where newlines are always represented as just  
\n.

You could do result.replace(/\r\n|\r/g, "\n"). But, it'd be better to have  
it done automatically without producing another copy of the file's data.

You could also just handle all newline formats when you're parsing the  
file's data for example, but I think it'd still be cool if it was done  
automatically before you even touch the file's data.

-- 
Michael
Received on Saturday, 6 February 2010 13:37:47 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:32:17 UTC