excel2csv icon indicating copy to clipboard operation
excel2csv copied to clipboard

Added require 'iconv' before you call before you call Excel.new

Open nicholasklick opened this issue 12 years ago • 5 comments

This allows excel2csv to work. See roo related discussion here: https://github.com/hmcgowan/roo/issues/13

nicholasklick avatar Oct 31 '12 19:10 nicholasklick

This should only be required when on ruby < 1.9. Can you wrap the require?

Something like:

if RUBY_VERSION == '1.8.7'                                                                                                                                                                                                                                       
  require 'iconv'                                                                                                                                                                                                                                                
end  

I get a warning about deprecated iconv on 1.9.3 otherwise.

scpike avatar Oct 31 '12 19:10 scpike

Sure. But I am using ruby-1.9.3 not 1.8.7.

Without the IConv require I get this with 1.9.3:

~/.rvm/gems/ruby-1.9.3-p194/gems/roo-1.10.1/lib/roo/excel.rb:284:in `platform_specific_iconv': uninitialized constant Excel::Iconv (NameError)

On Wed, Oct 31, 2012 at 2:37 PM, Stephen Pike [email protected]:

This should only be required when on ruby 1.8.7. Can you wrap the require?

if RUBY_VERSION == '1.8.7' require 'iconv' end

I get a warning about deprecated iconv on 1.9.3 otherwise.

— Reply to this email directly or view it on GitHubhttps://github.com/scpike/excel2csv/pull/1#issuecomment-9959000.

nicholasklick avatar Oct 31 '12 19:10 nicholasklick

Could this be a roo version issue?

On Wed, Oct 31, 2012 at 2:42 PM, Nicholas Klick [email protected]:

Sure. But I am using ruby-1.9.3 not 1.8.7.

Without the IConv require I get this with 1.9.3:

~/.rvm/gems/ruby-1.9.3-p194/gems/roo-1.10.1/lib/roo/excel.rb:284:in `platform_specific_iconv': uninitialized constant Excel::Iconv (NameError)

On Wed, Oct 31, 2012 at 2:37 PM, Stephen Pike [email protected]:

This should only be required when on ruby 1.8.7. Can you wrap the require?

if RUBY_VERSION == '1.8.7' require 'iconv' end

I get a warning about deprecated iconv on 1.9.3 otherwise.

— Reply to this email directly or view it on GitHubhttps://github.com/scpike/excel2csv/pull/1#issuecomment-9959000.

nicholasklick avatar Oct 31 '12 19:10 nicholasklick

We're both using roo 1.10.1. I'm on 1.9.3 as well, and have no problem without the require iconv. I'm not going to merge this since it works for me, but if you figure out the root cause of this I'd love to have a patch and/or some install notes for the readme.

Are you using rvm (I am)? https://rvm.io/packages/iconv/

Some more info from my working environment: bundle list Gems included by the bundle: * bundler (1.1.4) * choice (0.1.6) * faraday (0.8.0) * google-spreadsheet-ruby (0.1.8) * httpauth (0.1) * log4r (1.1.10) * multi_json (1.3.4) * multipart-post (1.1.5) * nokogiri (1.5.2) * oauth (0.4.6) * oauth2 (0.7.1) * rack (1.4.1) * roo (1.10.1) * ruby-ole (1.2.11.3) * rubyzip (0.9.8) * spreadsheet (0.6.9) * todonotes (0.1.0)

scpike avatar Oct 31 '12 19:10 scpike

Looks like we have the same setup. 1.9.3 on RVM.

I will dig into this and get back to you.

Nicholas$ bundle list Gems included by the bundle:

  • bundler (1.2.0)
  • choice (0.1.6)
  • faraday (0.8.0)
  • google-spreadsheet-ruby (0.1.8)
  • httpauth (0.1)
  • log4r (1.1.10)
  • multi_json (1.3.4)
  • multipart-post (1.1.5)
  • nokogiri (1.5.2)
  • oauth (0.4.6)
  • oauth2 (0.7.1)
  • rack (1.4.1)
  • roo (1.10.1)
  • ruby-ole (1.2.11.3)
  • rubyzip (0.9.8)
  • spreadsheet (0.6.9)
  • todonotes (0.1.0) Nicholas$ rvm list

rvm rubies

ruby-1.9.2-p320 [ x86_64 ] =* ruby-1.9.3-p194 [ x86_64 ]

On Wed, Oct 31, 2012 at 2:51 PM, Stephen Pike [email protected]:

We're both using roo 1.10.1. I'm on 1.9.3 as well, and have no problem without the require iconv. I'm not going to merge this since it works for me, but if you figure out the root cause of this I'd love to have a patch and/or some install notes for the readme.

Are you using rvm? https://rvm.io/packages/iconv/

Some more info from my working environment: bundle list Gems included by the bundle:

  • bundler (1.1.4)
  • choice (0.1.6)
  • faraday (0.8.0)
  • google-spreadsheet-ruby (0.1.8)
  • httpauth (0.1)
  • log4r (1.1.10)
  • multi_json (1.3.4)
  • multipart-post (1.1.5)
  • nokogiri (1.5.2)
  • oauth (0.4.6)
  • oauth2 (0.7.1)
  • rack (1.4.1)
  • roo (1.10.1)
  • ruby-ole (1.2.11.3)
  • rubyzip (0.9.8)
  • spreadsheet (0.6.9)
  • todonotes (0.1.0)

— Reply to this email directly or view it on GitHubhttps://github.com/scpike/excel2csv/pull/1#issuecomment-9959464.

nicholasklick avatar Oct 31 '12 19:10 nicholasklick