New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling UTF-8 #29
Comments
axlsx should be generating utf-8 by default. Are your strings utf8? |
Every string is in UTF-8. I'm a little bit confused by the documentation, I don't know if I should use the "XLS" extension or the "XLSX" extension. I've also added the following gems to my gemfile: gem 'zip-zip' If I try setting the format to "XLSX" the file I get is corrupted. If I get it with the "XLS" format, it's all fine but the UTF-8 isn't working. |
You should remove this from your Gemfile if you're not using it as it conflicts with to_spreadsheet.
This gem generates xlsx, it can't generate xls. |
Thing is, if I remove the gem (I just noticed it's in the docs as well), I get the error saying there's no MIME type for what I requested (XLSX). Should I live the mime_types.rb blank? If so, I'm not sure what I'm doing wrong, as I followed the readme step by step. The readme is a little bit confusing, there are a few places where "xls" appears, is this correct? Or should it be "xlsx"? |
It should be xlsx, I've updated the Readme. |
Thanks, in that case I'm not sure what the problem is. I'm getting the following error when rendering the html (because of the controller's code):
Should I live mime_types.rb blank? Or should I add the XLSX format? I'm not sure if the gem does this. My controller code is the following: respond_to do |format| |
Can you post the code here? What are your versions of Rails and Ruby? |
I've updated my last response with some code. |
Do you have this in the controller? class MyThingiesController < ApplicationController
respond_to :xlsx, :html # <-- this
...
end |
Also, what office product are you using to open the file? |
Yes, I'm using ActiveAdmin. It looks like this:
Since I'm getting this error I'm not able to download a file anymore, but I'm using Office 2015 on OSX Sierra |
The mime type is registered here: https://github.com/glebm/to_spreadsheet/blob/master/lib/to_spreadsheet/rails/mime_types.rb#L2 Not sure what the problem is in your case. |
I've managed to "move on", but now I get the following error when trying to render the XLSX:
So if I add format.xlsx { render layout:false, xlsx: :statistics, filename: "example" } it should work, but I get the error:
This is the full stacktrace:
|
What does your template look like? |
I've changed the layout to a "default one" with the following code: controller: application.html (layout):
But I still get
|
What is your template code? Where you render the table? |
The xlsx.haml only contains this:
I'm trying with a very simple HAML file now (_statistics.html.haml):
And I get the following error:
Before I was using an arb file, but I believe it was causing issues. Full stacktrace:
|
I could pinpoint the issue to the gem 'axlsx'. Once you update it there should be no issues, however, since I was using the gem roo I had conflicts finding the correct version for axlsx so that it was both compatible with roo, and with zip-zip. I got it working by adding
to my gemfile. Thank you very much for your help! |
Is there anyway to handle UTF-8? I'm currently having issues with it. It's not displaying the accent maks correctly
The text was updated successfully, but these errors were encountered: