commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: [fileupload] UTF-8 encoding issue
Date Mon, 01 Aug 2016 19:10:24 GMT
I can see that
in org.apache.commons.fileupload.FileUploadBase.getBoundary(String) we have:

  boundary = boundaryStr.getBytes("ISO-8859-1");

Should that be:

  boundary = boundaryStr.getBytes(headerEncoding);

?

Gary

On Mon, Aug 1, 2016 at 11:01 AM, Campbell, Lance <lance@illinois.edu> wrote:

> There is still an issue.
> I had a typo in my email.  There should not have been the line
> resp.setContentType("UTF-8");
>
> Sorry.
>
>
>
> -----Original Message-----
> From: Campbell, Lance [mailto:lance@illinois.edu]
> Sent: Monday, August 01, 2016 12:51 PM
> To: 'user@commons.apache.org' <user@commons.apache.org>
> Subject: [fileupload] UTF-8 encoding issue
>
> Commons File Upload 1.3.2
>
> I am using the commons file upload version 1.3.2 via servlets for
> apache-tomcat 8.  All of my servlets work with UTF-8 except for when I am
> using the commons file upload library.  It seems to be setting the encoding
> to "ISO-8859-1" .  I have set both the request and response headers to
> UTF-8.  I have also set the Java VM to use UTF-8.
>
> How can I get around this issue?
>
> I have read online to do the following:
> req.setCharacterEncoding("UTF-8");
> resp.setContentType("UTF-8");
> resp.setCharacterEncoding("UTF-8");
>
> I have also read to set this at the form:
>
> accept-charset="UTF-8"
>
> It seems like your code is hardcoding the encoding to "ISO-8859-1" in the
> class FileUploadBase.
>
> Why not allow us to set the encoding in a method then use the "ISO-8859-1"
> as a fall back?
>
> Thanks,
>
> Lance Campbell
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message