You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Alex Kwan <er...@hotmail.com> on 2003/12/18 06:31:09 UTC

Bug:Uploading encoding problem (Caused by DefaultMultipartDecoder)

Hi, All

When upload a file which name has a different encoding than ISO-8859-1,
the upload component can not get the correct filename.

The problem was caused by the following reason:
In the decode method of DefaultMultipartDecoder

..
    public void decode(HttpServletRequest request)
    {
        Map partMap = new HashMap();

        request.setAttribute(PART_MAP_ATTRIBUTE_NAME, partMap);
        String encoding = request.getCharacterEncoding();

        DiskFileUpload upload = new DiskFileUpload();

        try
        {
            parts = upload.parseRequest(request, _thresholdSize, _maxSize,
_repositoryPath);
        }
...

just before the upload.parseRequest, we need to add the following line:

    upload.setHeaderEncoding(encoding);

that will be
..
        try
        {
            upload.setHeaderEncoding(encoding);
            parts = upload.parseRequest(request, _thresholdSize, _maxSize,
_repositoryPath);
        }
..

otherwise, the the request header will be parsed using the ISO-8859-1
encoding, which caused this problem.

I have fired a bug report. You can get it from
http://issues.apache.org/bugzilla/show_bug.cgi?id=25611
Hope it will soon be addressed.
                                                        Alex Kwan

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org