lifecoder
lifecoder

Reputation: 1434

Ruby CSV parsing from Excel with multilingual document

I have a csv document exported from Excel and containing both english and non-english (russian) letters.

I've managed to open it with

CSV.open @tmp, "rb:ISO-8859-1", {col_sep: ";"}

but it read russian symbols as \xCE\xF1\xF2\xE0\xEB\xFC\xED\xFB\xE5 \xE7\xE0\xEF\xF7 etc. I've try "rb:ISO-8859-1:UTF-8" but get "ArgumentError: invalid byte sequence in UTF-8", same as csv.open runned without mode.

How this could be fixed? Also, how I could find 'mode' argument options - I couldn't understand from docs where it is described.

Main environment is Ubuntu server, if it matters.

Upvotes: 0

Views: 324

Answers (1)

Narmadha
Narmadha

Reputation: 55

try using this format

r:ISO-8859-15:UTF-8

Upvotes: 1

Related Questions