Note that there are some explanatory texts on larger screens.

plurals
  1. PORuby csv error : invalid byte sequence in UTF-8
    text
    copied!<pre><code>[sagar@BL-53 RcTools]$ irb 1.9.3p0 :001 &gt; require 'csv' =&gt; true 1.9.3p0 :002 &gt; master = CSV.read("./public/jobs/in/Appexchange_Applications_Companies_487.csv") ArgumentError: invalid byte sequence in UTF-8 from /home/sagar/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/csv.rb:1855:in `sub!' from /home/sagar/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/csv.rb:1855:in `block in shift' from /home/sagar/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/csv.rb:1849:in `loop' from /home/sagar/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/csv.rb:1849:in `shift' from /home/sagar/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/csv.rb:1791:in `each' from /home/sagar/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/csv.rb:1805:in `to_a' from /home/sagar/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/csv.rb:1805:in `read' from /home/sagar/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/csv.rb:1411:in `block in read' from /home/sagar/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/csv.rb:1354:in `open' from /home/sagar/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/csv.rb:1411:in `read' from (irb):2 from /home/sagar/.rvm/rubies/ruby-1.9.3-p0/bin/irb:16:in `&lt;main&gt;' 1.9.3p0 :003 &gt; </code></pre> <p>But when i do </p> <pre><code>1.9.3p0 :003 &gt; master = CSV.open("./public/jobs/in/Appexchange_Applications_Companies_487.csv","r") =&gt; &lt;#CSV io_type:File io_path:"./public/jobs/in/Appexchange_Applications_Companies_487.csv" encoding:UTF-8 lineno:0 col_sep:"," row_sep:"\r\n" quote_char:"\""&gt; 1.9.3p0 :004 &gt; </code></pre> <p>I just want to know why this is happening and what is solution. And i want to read the csv because it returns an array of that csv. So if i read file in first way like</p> <pre><code>master = CSV.read("./public/jobs/in/Appexchange_Applications_Companies_487.csv") </code></pre> <p>It returns me an array</p> <pre><code>1.9.3p0 :008 &gt; master.class =&gt; Array </code></pre> <p>But in second case, class is CSV. What is solution to read csv in first way.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload