Skully
Skully

Reputation: 485

rails and html xls export with encoding error

I am using a html table definition as template to export to xls in rails. It is described here: http://railscasts.com/episodes/362-exporting-csv-and-excel?view=asciicast

I am not using the MS xls syntax described at the bottom of the article, just standard html. My problem is, that i get encoding errors with umlauts or other special characters inside MS Office or LibreOffice. When i open the file with a text-editor, everything is fine. The office programs have usually problems with it.

How can a make special characters work? Can i define some encoding in the header?

Upvotes: 1

Views: 845

Answers (1)

Skully
Skully

Reputation: 485

define a layout application.xls.haml with the following content:

%html
  %head
    %meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}
  %body
    = yield

Upvotes: 2

Related Questions