From: Kenny Lam Date: 2010-11-05T03:40:39+09:00 Subject: 1.9 CSV Parsing Issues I'm currently porting a script to 1.9 and I'm having problems getting CSV parsing to work. This script worked fine in 1.8.7 and used the FasterCSV library for parsing. After playing around in the IRB, I have determined that the current parser seems incapable of handling newlines as row seperators (a rather basic and important feature). I tested with a simple file whose contents are: field1,field2 field3,field4 This file was created using a basic text editor and does not contain any unorthodox newline characters. Attempting to parse this file results in the following error: C:/Ruby192/lib/ruby/1.9.1/csv.rb:1885:in `block (2 levels) in shift': Unquoted fields do not allow \r or \n (line 1). (CSV::MalformedCSVError) from C:/Ruby192/lib/ruby/1.9.1/csv.rb:1856:in `each' from C:/Ruby192/lib/ruby/1.9.1/csv.rb:1856:in `block in shift' from C:/Ruby192/lib/ruby/1.9.1/csv.rb:1818:in `loop' from C:/Ruby192/lib/ruby/1.9.1/csv.rb:1818:in `shift' from C:/Ruby192/lib/ruby/1.9.1/csv.rb:1760:in `each' The return value of the opened csv file shows row_sep to be "\r\n" which seems correct. I have tried manually setting the value of row_sep when calling CSV::open but I get the same issue. Once again, I do not have this problem with FasterCSV under 1.8.7 (which as I understand, is the same code used in 1.9's csv library). I'm using Ruby 1.9.2p0 on Windows XP. I would greatly appreciate any help. -- Posted via http://www.ruby-forum.com/.