Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArgumentError: invalid byte sequence in UTF-8 #3523

Closed
labolado opened this issue Dec 8, 2015 · 4 comments
Closed

ArgumentError: invalid byte sequence in UTF-8 #3523

labolado opened this issue Dec 8, 2015 · 4 comments

Comments

@labolado
Copy link

labolado commented Dec 8, 2015

code:

CSV.foreach("aa.csv", {:encoding => 'utf-8'}) do |row|
end
puts 'read ok'

run result

pc:test$ ruby test.rb 
read ok
pc:test$ jruby  test.rb 
ArgumentError: invalid byte sequence in UTF-8
               =~ at org/jruby/RubyRegexp.java:1520
               =~ at org/jruby/RubyString.java:1740
  init_separators at /opt/local/share/java/jruby/lib/ruby/1.9/csv.rb:2058
       initialize at /opt/local/share/java/jruby/lib/ruby/1.9/csv.rb:1590
             open at /opt/local/share/java/jruby/lib/ruby/1.9/csv.rb:1349
          foreach at /opt/local/share/java/jruby/lib/ruby/1.9/csv.rb:1207
           (root) at test.rb:273
@jesjos
Copy link

jesjos commented Dec 8, 2015

Is this dependent on the content of aa.csv? If so: can you paste it?

@labolado
Copy link
Author

aa.csv.txt

@jesjos
Copy link

jesjos commented Dec 10, 2015

What version of jruby are you running? I tried this on 9.0.1.0 and it worked as expected.

@labolado
Copy link
Author

sorry, it's my fault.My default jruby version is 1.7.4 (1.9.3p392) 2013-05-16 2390d3b.I switched to 9.0.4.0, and it's ok now, thanks.

@kares kares added this to the Invalid or Duplicate milestone Dec 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants