Gotcha. Is the file actually opened when the controller is entered? (That's an honest question I'm interested in how that works coming as an upload from a form) The way you've described, that I failed to understand the first time, to me seems like the best way but I'd be interested to see what others have to say.
Sorry I couldn't be of more help. On Tuesday, July 15, 2014 5:47:57 AM UTC-6, Ruby-Forum.com User wrote: > > In this case, it is pretty certain that ever file will contain UTF-8 > characters, and in general, I think the cases are few where we can > assume input to be represented by 7-bit-ASCII. > > What I do not know for sure is whether or not the file will have a BOM, > but I think Ruby can figure this out automatically, when supplying the > "BOM" option on opening. > > It would make sense to allow also file using different encoding, such as > UTF-16, but this is something I will have to deal with later. > > The stackoverflow link you presented, doesn't really answer my problem > though. It just describes how I can *open* an UTF-8 file, and this is > the workaround I'm using meanwhile (as outlined in my posting where I > say: "I could create a File object by opening....". > > What I would like to know is, whether there is a simpler way (since the > file, after all, is already opened when my controller is entered), and > in particular why set_encoding doesn't work for my Tempfile object, > even though this would work well for a File object. > > -- > 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/3a88144c-8e87-4744-9302-e87d866806a7%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.