Sha256: 122e9713a5e6b0fd1f2a4fe2b561a9de701e72bada3b5805a1b86999640613d2

Contents?: true

Size: 872 Bytes

Versions: 18

Compression:

Stored size: 872 Bytes

Contents

require 'spec_helper'

fixture_path = 'spec/fixtures'

describe 'loading file with UTF-8 characters in the header' do

  # file which caused issues because of UTF-8 characters in the header
  it 'loads the file with force_utf8 flag set' do
    options = {col_sep:  ";", force_utf8: true}
    data = SmarterCSV.process("#{fixture_path}/problematic.csv", options)

    data.length.should eq 7
  end

  it 'loads the file with strings as keys' do
    options = {
      file_encoding: 'iso-8859-1:UTF-8', # important!
      col_sep:  ";", strings_as_keys: true,
    }
    data = SmarterCSV.process("#{fixture_path}/problematic.csv", options)

    data.length.should eq 7
    data.first.keys.sort.should eq [
      "compte",
      "date_de_comptabilisation",
      "date_opération",
      "date_valeur",
      "libellé",
      "montant",
      "référence"
    ]
  end

end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
smarter_csv-1.6.1 spec/smarter_csv/problematic.rb
smarter_csv-1.6.0 spec/smarter_csv/problematic.rb
smarter_csv-1.5.2 spec/smarter_csv/problematic.rb
smarter_csv-1.5.1 spec/smarter_csv/problematic.rb
smarter_csv-1.5.0 spec/smarter_csv/problematic.rb
smarter_csv-1.4.2 spec/smarter_csv/problematic.rb
smarter_csv-1.4.0 spec/smarter_csv/problematic.rb
smarter_csv-1.3.0 spec/smarter_csv/problematic.rb
smarter_csv-1.2.8 spec/smarter_csv/problematic.rb
smarter_csv-1.2.7 spec/smarter_csv/problematic.rb
pokedex-terminal-0.2.8 vendor/bundle/ruby/2.7.0/gems/smarter_csv-1.2.6/spec/smarter_csv/problematic.rb
pokedex-terminal-0.2.7 vendor/bundle/ruby/2.7.0/gems/smarter_csv-1.2.6/spec/smarter_csv/problematic.rb
pokedex-terminal-0.2.6 vendor/bundle/ruby/2.7.0/gems/smarter_csv-1.2.6/spec/smarter_csv/problematic.rb
pokedex-terminal-0.2.5 vendor/bundle/ruby/2.7.0/gems/smarter_csv-1.2.6/spec/smarter_csv/problematic.rb
pokedex-terminal-0.2.4 vendor/bundle/ruby/2.7.0/gems/smarter_csv-1.2.6/spec/smarter_csv/problematic.rb
smarter_csv-1.2.6 spec/smarter_csv/problematic.rb
smarter_csv-1.2.5 spec/smarter_csv/problematic.rb
smarter_csv-1.2.4 spec/smarter_csv/problematic.rb