From: aruprakshit@... Date: 2014-02-28T22:31:37+00:00 Subject: [ruby-core:61154] [Backport200 - Backport #9582] [Open] CSV#headers not giving expected results. Issue #9582 has been reported by arup rakshit. ---------------------------------------- Backport #9582: CSV#headers not giving expected results. https://bugs.ruby-lang.org/issues/9582 * Author: arup rakshit * Status: Open * Priority: Normal * Assignee: ---------------------------------------- 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"]] -- http://bugs.ruby-lang.org/