Does setting

config.encoding = "utf-8"

in your config/application.rb help? You'd also need to add 

# encoding: UTF-8

to the top of your file.

I was reading 
this http://craiccomputing.blogspot.com/2011/02/rails-utf-8-and-heroku.html 
which seems to discuss this problem.

On Wednesday, July 16, 2014 1:16:13 AM UTC-6, Ruby-Forum.com User wrote:
>
> Yes, it is, as I found by trial-and-error. Note that the object is not 
> just a File, it is of class Tempfile. I think this is quite common when 
> working with a Tempfile object. To make a Tempfile threadsafe, you have 
> to combine the creation of the filename and the creation of the file 
> into one call (otherwise you have a race condition if another process 
> tries to create a tempfile in the same directory and by accident comes 
> up with the same name). 
>
> While I didn't dive into the source code to see, how Rails is 
> implemented in this respect, it would be reasonable to assume, that for 
> the upload, a Tempfile object is created for read+write, the uploaded 
> file is written to it, and the file pointer is repositioned at the 
> beginning of the file, before it is handed over to the controller. Since 
> the uploading process can't know anything about the encoding, the file 
> must have been opened as a binary file. That's why I had the idea that I 
> just need to set the encoding to the desired value before starting to 
> read from the file. 
>
> -- 
> Posted via http://www.ruby-forum.com/. 
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/61c89b0b-a2df-481b-b317-f2f780cba188%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to