Heya Mechanics, I''m hoping someone has stumbled across this and knows an answer. I am scraping an upload to send a .csv to a .Net app. ?I''ve verified that the .csv I''ve created is: ?file update.csv update.csv: ASCII text, with very long lines, with CRLF line terminators but those CR''s are getting stripped and what winds up at the other end is only LF line terminations. ?It being a brainless .Net app on the other end, that''s not good enough and it''s broken. I''ve been through the Mechanize code and it appears to be handling it all binary all the time, so I can''t find anywhere it''d be stripping the CRs. It occurs with both Mech 1.0 and 2.0, ruby 1.8.7 and 1.9.2. Does anyone have a clue where my CRs are going and how to stop it? Thanks, Brian
On Jul 20, 2011, at 6:32 AM, Brian Kennedy wrote:> Heya Mechanics, > > I''m hoping someone has stumbled across this and knows an answer. > > I am scraping an upload to send a .csv to a .Net app. I''ve verified > that the .csv I''ve created is: > file update.csv > update.csv: ASCII text, with very long lines, with CRLF line terminators > but those CR''s are getting stripped and what winds up at the other end > is only LF line terminations. It being a brainless .Net app on the > other end, that''s not good enough and it''s broken. > > I''ve been through the Mechanize code and it appears to be handling it > all binary all the time, so I can''t find anywhere it''d be stripping > the CRs. > > It occurs with both Mech 1.0 and 2.0, ruby 1.8.7 and 1.9.2. > > Does anyone have a clue where my CRs are going and how to stop it?Are you on windows? How are you reading in update.csv, File.read? Try File.binread instead.
On Wed, Jul 20, 2011 at 2:50 PM, Eric Hodel <drbrain at segment7.net> wrote:> On Jul 20, 2011, at 6:32 AM, Brian Kennedy wrote: > >> Heya Mechanics, >> >> I''m hoping someone has stumbled across this and knows an answer. >> >> I am scraping an upload to send a .csv to a .Net app. ?I''ve verified >> that the .csv I''ve created is: >> ?file update.csv >> update.csv: ASCII text, with very long lines, with CRLF line terminators >> but those CR''s are getting stripped and what winds up at the other end >> is only LF line terminations. ?It being a brainless .Net app on the >> other end, that''s not good enough and it''s broken. >> >> I''ve been through the Mechanize code and it appears to be handling it >> all binary all the time, so I can''t find anywhere it''d be stripping >> the CRs. >> >> It occurs with both Mech 1.0 and 2.0, ruby 1.8.7 and 1.9.2. >> >> Does anyone have a clue where my CRs are going and how to stop it? > > Are you on windows? > > How are you reading in update.csv, File.read? > > Try File.binread instead. > _______________________________________________ > Mechanize-users mailing list > Mechanize-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mechanize-users >I''m not, my server is SUSE, but obviously the receiving end is windows with the .Net app. I''ve tried using upload_form.file_uploads.first.file_name = TMPFILE for mechanize to handle it itself (which I verified in source does do a binread) and upload_form.file_uploads.first.file_data = File.binread(TMPFILE) The result is same stuff, different fan. Thanks for your thought into my matter, Brian