Hello,
Thanks for trying the (new) csvreader library.
> Is there a way to pass encoding options to csvreader? I keep getting "invalid byte sequence in UTF-8" when trying to read a CSV file.
By default all files are opened with the (file) mode set to
'r:bom|utf-8' [1]
If you use CsvReader.open (or Csv.open) you can pass in the
mode as a second parameter (it works like File.open because it is
File.open :-).
The recommendation is to (always use utf-8 internally) and
convert your "external" source e.g.:
Csv.open( "windows.csv", "r:windows-1251:utf-8" ).read / each /
etc. or something
Let us know how it goes. Cheers. Prost.
[1]
https://github.com/csvreader/csvreader/blob/master/lib/csvreader/reader.rb#L11