tilo/smarter_csv

Header key included an invisible char

DalenW opened this issue · 1 comments

The first key (I'm not sure if this matters) began with char 65279, which is a zero-width space. Spent some time trying to figure that one out.

This sounds messy and/or dangerous, but what if keys only contained alphanumeric characters and '_' of course for spacing.

My current work around is last_name_key = csv_member.keys[0], but this only works if last_name is indeed the first column in the csv file I'm importing.

I fixed this. But this fix only works for version 1.2. I added this option strip_chars_from_headers: 65_279.chr

Full line:
csv_data = SmarterCSV.process(Rails.root.join("import/#{file_name}"), { strip_chars_from_headers: 65_279.chr })