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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/bec1374f9fb66b2a472f3d96c3252228%40ruby-forum.com. For more options, visit https://groups.google.com/d/optout.

