pcreux/csv-importer

German umlauts issue

chriskrams opened this issue · 3 comments

Hi all,

I have an issue with importing german umlauts.
The CSV file I created is in 'UTF-8'encoding.
The CSV import is [MyImporterClass].new(file: params[:file], quote_char: '"', encoding: 'UTF-8').

No Error but the importer cuts off all german umlauts like äöüß...

Workaround:
csv_content = File.read(params[:file].tempfile.to_path.to_s, encoding: "UTF-8")
import_csv = [MyImporterClass].new(content: csv_content)

Characters encoding is hard. :)

Can you confirm that the csv file encoding is UTF-8? Can you try: $> file -I PATH?

I send the file via format.csv { send_data @test.generate_csv() ...
@test.generate_csv() config has encoding: 'UTF-8'
After downloading I checked the file with Notepad++ that it is UTF-8. (Your file -i doesn't work for me on a windows machine) and uploaded it as I described,

If you have time, you can see if you can reproduce it, until then I have a workaround.
Ingenious gem btw saved me a lot of time. :D