I'm writing a Rails app that allows the user to upload TSV (Tab-separated values) files to be parsed on the server. Those files are encoded in UTF-16. All goes fine in local, but when I try to open the file with such encoding on Heroku, I'm getting a warning that says warning: Unsupported encoding utf-16 ignored
. When later I try to read such file, it obviously fails stating invalid byte sequence in UTF-8
. See an excerpt of the code below:
File.open(params[:batch_import][:file].path, 'r:utf-16') do |f|
@recipients = Recipient.from_tsv(f.read)
end
Is there any walkaround that I can do?