E
E
eldar_web2015-08-25 13:32:47
Ruby on Rails
eldar_web, 2015-08-25 13:32:47

How to define encoding in Rails when generating xls file?

I link like this:

<%= link_to 'Скачать excel', exportsub_path(format: "xls") %>

I generate an excel file like this:
@subscribers = Subscriber.where(user_id: session[:user_id])
    respond_to do |format|
      format.html
      format.xls
 end

And in view the usual table with a cycle.
And so, the excel-file loads, but there kryakozabry. How to solve the problem or how to set the correct encoding?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sadgb, 2015-08-29
@sadgb

In general, we made csv for Excel and also had krakozyabry. Decided by converting to UCS2-LE or UTF-16
and adding BOM csv_string.insert(0,"\xFF\xFE")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question