Project

General

Profile

Actions

Bug #9582

closed

CSV#headers not giving expected results.

Added by pritamdey (arup rakshit) almost 11 years ago. Updated almost 11 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
-
Backport:
[ruby-core:61154]

Description

It seems something not working as expected in CSV. I tried to find the reason here , http://rxr.whitequark.org/mri/source/lib/csv.rb but I failed.

require 'csv'

content = <<_
key,fr
edit,Éditer
close,Fermer
_

File.write('test',content)

file = CSV.read('test', :headers => true)
file.headers # => ["key", "fr"]
file.to_a # => [["key", "fr"], ["edit", "Éditer"], ["close", "Fermer"]]

content = <<_
key,fr

edit,Éditer
close,Fermer
_

File.write('test1',content)

file = CSV.read('test1', :headers => true)
file.headers # => []  # <~~~~~~~~~~~ Is this a bug ?
file.to_a # => [[], [], ["edit", "Éditer"], ["close", "Fermer"]]

Files

9582.patch (870 Bytes) 9582.patch tlewin (Thiago Lewin), 03/05/2014 05:16 AM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0