Issue Details (XML | Word | Printable)

Key: FILEUPLOAD-13
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Amichai Rothman
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Commons FileUpload

[fileupload] Use the ServletRequest encoding as default

Created: 16/Apr/05 07:48 PM   Updated: 30/Oct/06 09:42 PM
Return to search
Component/s: None
Affects Version/s: 1.0 Final
Fix Version/s: None

Time Tracking:
Not Specified

Environment:
Operating System: Windows XP
Platform: PC

Bugzilla Id: 34483
Resolution Date: 30/Oct/06 09:42 PM


 Description  « Hide
The fileupload package operates on a ServletRequest to conveniently extract it's
content. The ServletRequest.getCharacterEncoding() method "Returns the name of
the character encoding used in the body of this request", and thus should be
used as a default by the fileupload processing as well.

Further, whether from the servlet request or an explicit set on the FileUpload
instance, the encoding should propagate to the FileItem (again by default,
unless it's overridden by a part content type header or explicit set).

Currently, in order to have a UTF-8 request properly parsed, one must first call

request.setCharacterEncoding("UTF-8")

then call

diskFileUpload.setHeaderEncoding("UTF-8")

and finally use

fileItem.getString("UTF-8")

There's no reason for this duplicity - if the first is set, the rest should
propagate by default, unless explicitly overridden. This is a source for bugs
and unneeded extra work (it took quite a while to figure these out, after
examining the source code - this work can be saved for other developers, after
all, that's what this package is for!).



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
There are no subversion log entries for this issue yet.