I am using fastercsv gem for csv export with utf-8 encoding.
When ever i export any arabic content in my csv using utf-8 , when i try to open in windows it comes out as some strange characters. where as in ubuntu it comes fine.
I am working with ruby 1.8.7. fastercsv (1.5.5) rails 2.3.5
csv_string=FasterCSV.generate(:encoding => 'utf-8') do |csv| csv << header_col
csv << data_col end
filename = "Print- #{Time.now.to_date.to_s}.xls"
send_data(csv_string, :type => 'text/xls; charset=utf-8; header=present', :filename => filename)
this has worked for me
csv_string=FasterCSV.generate(:col_sep => "\t") do |csv|
end
send_data Iconv.conv("utf-16", "utf-8", csv_string),:type => 'text/csv; charset=iso-8859-1; header=present', :disposition => "attachment; filename=#{filename}.csv"