Hi all, I''m sick of hitting bugs in 3rd party libs where the issue is that the authors didn''t do a binary read on the data. It''s hard to track down sometimes and it currently makes creating cross-platform code more difficult. Is there *any* downside to making IO.read binary by default (on Windows) that anyone can think of? Thanks, Dan
On 9/20/07, Daniel Berger <djberg96 at gmail.com> wrote:> I''m sick of hitting bugs in 3rd party libs where the issue is that the > authors didn''t do a binary read on the data. It''s hard to track down > sometimes and it currently makes creating cross-platform code more > difficult.I agree> Is there *any* downside to making IO.read binary by default (on Windows) > that anyone can think of?When reading a text file with \r\n line endings, it will not "split" the same. pth
> -----Original Message----- > From: win32utils-devel-bounces at rubyforge.org > [mailto:win32utils-devel-bounces at rubyforge.org] On Behalf Of > Patrick Hurley > Sent: Thursday, September 20, 2007 6:27 AM > To: Development and ideas for win32utils projects > Subject: Re: [Win32utils-devel] IO.read - binary by default? > > > On 9/20/07, Daniel Berger <djberg96 at gmail.com> wrote: > > I''m sick of hitting bugs in 3rd party libs where the issue > is that the > > authors didn''t do a binary read on the data. It''s hard to > track down > > sometimes and it currently makes creating cross-platform code more > > difficult. > > I agree > > > Is there *any* downside to making IO.read binary by default (on > > Windows) that anyone can think of? > > When reading a text file with \r\n line endings, it will not > "split" the same.Hm, what do you mean? For methods like IO.readlines and such? Couldn''t we just modify those methods? Or did you mean something else? Regards, Dan This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.
On 9/20/07, Berger, Daniel <Daniel.Berger at qwest.com> wrote:> Hm, what do you mean? For methods like IO.readlines and such? Couldn''t > we just modify those methods? Or did you mean something else?We could, but I am not sure you can unambiguously pull this off. Right now if you io.puts to a file on windows it writes \r\n, if the file is in binary, it only writes the \n. Won''t this change break a lot of existing windows scripts? I wish I had a time machine, could go back to 1981 and smack someone at microsoft and get them to do this (and path separators) correctly from the start (and I would probably purchase some of there stock while I was there). But it is an unholy mess that cannot be easily fixed -- please tell me I am wrong :-) pth