Problems uploading a file in UTF-8 using Tomcat / Struts

From: Robert Bowen (sygsix_at_gmail.com)
Date: 01/12/05


Date: 12 Jan 2005 09:00:17 -0800

I am using Struts' FormFile class to upload a text file from a
multipart form.

Everything works fine in Windoze but now that we have installed it in
Linux we are getting an error reading the text file, it says it can't
read it because it is in UTF-8.

We are working in Spanish and as such have characters with accents,
etc. Do I have to tell Tomcat (in the web.xml with the
SetCharacterEncodingFilter filter) to treat the file as ISO-8859-1?

I read that this filter is useful when you have a multipart form with
fields of both type File and normal text fields, so that the normal
text fields are encoded correctly, but that it doesn't affect File
fields. And that in order to upload the file correctly I would need
something like the Jakarta Commons upload utility class. But I imagine
the Struts FormFile uses commons anyway, no?

I've never had to do this for any other application but then again,
anything is possible. Any help much appreciated, this problem is
driving me NUTS!

Thanks,
syg



Relevant Pages

  • Re: Problems uploading a file in UTF-8 using Tomcat / Struts
    ... >Linux we are getting an error reading the text file, ... >I read that this filter is useful when you have a multipart form with ... And that in order to upload the file correctly I would need ... wondering why it would would care about the encoding of the uploaded ...
    (comp.lang.java.programmer)
  • Re: Problems uploading a file in UTF-8 using Tomcat / Struts
    ... that the client and server have the same character encoding. ... And that in order to upload the file correctly I would need ... > I don't know anything about the Struts FormFile class, ...
    (comp.lang.java.programmer)
  • Re: File uploading with JSP
    ... I submit the multipart form containing the upload to a Perl script (which can ... handle form inputs and multipart data in the same submission), ... file.jsp can then retrieve the values from the query string. ...
    (comp.lang.java.programmer)
  • Upload and download via struts
    ... I am tring to create a simple upload and download file manager program using ... struts. ... I have gotten the upload part to work fine. ...
    (comp.lang.java.programmer)
  • Re: Java FTP Upload (ready2go-Example-Webpage)
    ... Look at the struts-upload.war application example bundled with struts. ... > I need a possibility to upload large files from a web-page. ...
    (comp.lang.java.programmer)

Loading