You can clone with
HTTPS or Subversion.
Imported from Lighthouse. Original ticket at: http://rails.lighthouseapp.com/projects/8994/tickets/6470
Created by Franck - 2011-02-25 15:37:10 UTC
I run into a problem when I submit a form with a text field and a filename of an uploaded file both containing special chars.
Tracking down the issue it seems that while ActionDispatch force the encoding of all string paramaters to UTF-8 (see ActionDispatch::Http:Parameters encode_params private method), it does not do at to the filename of the uploaded file.
params is then filled with two different encoding (UTF-8 and ASCII-8BIT) causing an Encoding::CompatibilityError later on Arel-2.0.8 (to_sql.rb visit_Arel_Nodes_Values method).
I monkey patched ActionDispatch::Http:UploadedFile like so and it works :
@original_filename = hash[:filename].force_encoding("UTF-8")
@content_type = hash[:type]
@headers = hash[:head]
@tempfile = hash[:tempfile]
raise(ArgumentError, ':tempfile is required') unless @tempfile
My computing skill stop here. I let you guys decide if this is a bug or if I'm doing something wrong.
Imported from Lighthouse.
Comment by Jim Sagevid - 2011-04-27 09:09:04 UTC
why is this issue closed? is there a better way to deal with this matter?
i'm still monkey patching the code to bypass this problem.
encode the uploaded file's name in the default external encoding - Cl…