Xls export file format and csv format will be garbled when the situation
0, the premise of
At database.yml using utf8 encoding connect to database:
encoding: utf8
1, xls
Use Version 0.6.3
Previous versions of the low (<= 0.3.5.1) of the spreadsheet export xls or have utf-8 encoding garbled, the upgrade to the latest 0.6.3, when carrying a downward-compatible files can be very good excel.rb solve the problem, This method only add_worksheet interface should pay attention to what must be without parameters name
2, csv
Csv file headers required to write utf-8 BOM:
output = StringIO.new("", "w")
# make excel using utf8 to open csv file
head = 'EF BB BF'.split(' ').map{|a|a.hex.chr}.join()
output.write(head)







