I have a multipart / form-data form to upload a csv file to a rest easy (JAX RS) webservice. This file can contain iso-8859-1 characters like for example é. When I upload the file through Firefox these characters are garbled and they end up like a ?. When I upload the file through Internet Explorer everything works fine.
I've done a lot of reading and found out that there's a problem in firefox combining multipart / form-data and the charset attribute (enctype='multipart/form-data; charset=ISO-8859-1'
) doesn't work.
So I've tried setting <meta http-equiv="Content-Type" content="text/csv; charset=iso-8859-1" />
in my HTML page (I also tried setting text/html or multipart/form-data in stead of text/csv but none of that seems to make a difference.
I went through the rest easy api and found something about 'overwriting the default fallback content type for multipart messages'. The default fallback when no content type is found is us-ascii. The characters I try to process (é,..) don't exist in us-ascii so it makes sense they end up garbled. Overriding this default fallback content type doesn't seem to help either (see: http://docs.jboss.org/resteasy/docs/1.2.GA/userguide/html/Multipart.html)
So am I right when I say that Internet Explorer sends the content-type+charset correctly in the http header, so everything goes well. And that firefox messes things up while trying to send the content-type/charset while combined with multipart/form-data? I have done my searching through stackoverflow but none of the approved solutions seem to work in my case.
Has anybody had开发者_如何学Go this specific problem before? (multipart / form-data file upload using Jboss rest easy framework)? Something else I can try?
Thanks in advance!
Yannick
精彩评论