Colin, That shows how to create a Tempfile with a given encoding but the question is when a user uploads a file through a form and Rails creates a Tempfile is there a way to indicate that it should always create those Tempfiles with a default encoding such as UTF-8?
On Thursday, July 17, 2014 8:12:27 AM UTC-6, Colin Law wrote: > > On 17 July 2014 10:22, Ronald Fischer <li...@ruby-forum.com <javascript:>> > wrote: > > As far I understand this article, this related to Rails 3 and MySQL, and > > how to use UTF8 encoded data everywhere. I don't know about MySQL, but > > Rails 4 and Ruby 2 with SQLite don't suffer this problem: I didn't have > > any trouble, processing all kinds of Unicode characters with my > > application, and processing the uploaded file also works fine, as long I > > use my (not very elegant) trick to open it a second time with the > > desired encoding. > > > > It now occurs to me, that the question is maybe not Rails-specific, but > > a general Ruby question - how to change the encoding of a Tempfile > > object. > > I have not been following this thread in detail, but [1] discusses how > to use the encoding option when creating a Tempfile. > > [1] > http://www.ruby-doc.org/stdlib-1.9.3/libdoc/tempfile/rdoc/Tempfile.html > > Colin > -- 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/6af117a7-b554-4ada-84b3-3a362c3e0973%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.