Olá estou com dificuldade de mostra os caracteres especiais quando abro meu arquivo CSV no excel,segue abaixo como estar.
Controler:
respond_to do |format|
format.html
format.csv {
send_data @issues.to_csv(col_sep: ';',encoding: 'UTF-8'), filename: "DEMANDAS-#{Date.today}.csv"
}
model:
def self.to_csv(options = {})
desired_columns = ["ID" , "TITLE" , "STATUS" , "SPRINT" ,"DATA PREVISTA DE ENTREGA" , "TIPO DE DEMANDA"]
CSV.generate(options) do |csv|
# header columns
csv << desired_columns
# data columns
all.sort_by{|issuet| issuet[:state]}.each do |issue|
labelissue = issue.labels
milestone = issue.milestone
issue_labels = []
issue.labels.each do |label|
issue_labels << label.name
end
csv << [issue.iid, issue.title, issue.state, milestone.blank? ? ' a ser planejado' : milestone.title, milestone.blank? ? 'Sem planejamento' : milestone.due_date, issue_labels.join(" / ")]
end
end
end